"Index was outside the bounds of the array" exception on DecodeMultiple
Korzer420 opened this issue · 3 comments
Korzer420 commented
Hey,
I'm aware that this issue is the same as described in #400 , but it seems to happen in the newest version as well.
I'm using the ZXing.Net.Bindings.Windows.Compability (Version 0.16.10) package from the NuGet manager in my .Net Core 6.0 application.
When trying to read the document attached below, it throws the out of bounds exception on DecodeMultiple.
Code:
MagickImage image;
...
BarcodeReader<Bitmap> reader = new(null,
bitmap => new BitmapLuminanceSource(bitmap),
luminance => new GlobalHistogramBinarizer(luminance)
{
Options =
{
CharacterSet = "ISO-8859-1",
TryHarder = tryHarder,
ReturnCodabarStartEnd = true
}
};
reader.Options.PossibleFormats = null;
using Bitmap page = image.ToBitmap();
Result[] results = reader.DecodeMultiple(page);
These errors seem to appear on page 1 and 5.
(Tiff is in the zip because github doesn't seem to support tiff files)
BarcodeTest.zip
micjahn commented
I can't reproduce it. Do you have a full stack trace?
Korzer420 commented
Here
at ZXing.Maxicode.MaxiCodeReader.extractPureBits(BitMatrix image)
at ZXing.Maxicode.MaxiCodeReader.decode(BinaryBitmap image, IDictionary`2 hints)
at ZXing.MultiFormatReader.decodeInternal(BinaryBitmap image, ResultPointCallback rpCallback)
at ZXing.MultiFormatReader.decodeInternal(BinaryBitmap image)
at ZXing.Multi.GenericMultipleBarcodeReader.doDecodeMultiple(BinaryBitmap image, IDictionary`2 hints, IList`1 results, Int32 xOffset, Int32 yOffset, Int32 currentDepth)
at ZXing.Multi.GenericMultipleBarcodeReader.doDecodeMultiple(BinaryBitmap image, IDictionary`2 hints, IList`1 results, Int32 xOffset, Int32 yOffset, Int32 currentDepth)
at ZXing.Multi.GenericMultipleBarcodeReader.doDecodeMultiple(BinaryBitmap image, IDictionary`2 hints, IList`1 results, Int32 xOffset, Int32 yOffset, Int32 currentDepth)
at ZXing.Multi.GenericMultipleBarcodeReader.doDecodeMultiple(BinaryBitmap image, IDictionary`2 hints, IList`1 results, Int32 xOffset, Int32 yOffset, Int32 currentDepth)
at ZXing.Multi.GenericMultipleBarcodeReader.doDecodeMultiple(BinaryBitmap image, IDictionary`2 hints, IList`1 results, Int32 xOffset, Int32 yOffset, Int32 currentDepth)
at ZXing.Multi.GenericMultipleBarcodeReader.decodeMultiple(BinaryBitmap image, IDictionary`2 hints)
at ZXing.BarcodeReaderGeneric.DecodeMultiple(LuminanceSource luminanceSource)
Korzer420 commented
It seems that the problem is caused by my preprocessing somehow rather than the ZXing library.