Issue #862 : avoid invalid codeword from bad EC number estimate

This commit is contained in:
Sean Owen 2020-06-03 11:50:03 -05:00
parent 9068f64eb5
commit c89470b2b0

View file

@ -244,8 +244,10 @@ public final class PDF417ScanningDecoder {
}
barcodeMatrix01.setValue(calculatedNumberOfCodewords);
} else if (numberOfCodewords[0] != calculatedNumberOfCodewords) {
// The calculated one is more reliable as it is derived from the row indicator columns
barcodeMatrix01.setValue(calculatedNumberOfCodewords);
if (calculatedNumberOfCodewords >= 1 && calculatedNumberOfCodewords <= PDF417Common.MAX_CODEWORDS_IN_BARCODE) {
// The calculated one is more reliable as it is derived from the row indicator columns
barcodeMatrix01.setValue(calculatedNumberOfCodewords);
}
}
}