mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 11:47:26 -08:00
Possible fix for https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38486#c10
This commit is contained in:
parent
a6273e3bc7
commit
fa19d4758f
|
@ -220,22 +220,38 @@ final class DecodedBitStreamParser {
|
||||||
case MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:
|
case MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:
|
||||||
ECIStringBuilder segmentCount = new ECIStringBuilder();
|
ECIStringBuilder segmentCount = new ECIStringBuilder();
|
||||||
codeIndex = numericCompaction(codewords, codeIndex + 1, segmentCount);
|
codeIndex = numericCompaction(codewords, codeIndex + 1, segmentCount);
|
||||||
resultMetadata.setSegmentCount(Integer.parseInt(segmentCount.toString()));
|
try {
|
||||||
|
resultMetadata.setSegmentCount(Integer.parseInt(segmentCount.toString()));
|
||||||
|
} catch (NumberFormatException nfe) {
|
||||||
|
throw FormatException.getFormatInstance();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:
|
case MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:
|
||||||
ECIStringBuilder timestamp = new ECIStringBuilder();
|
ECIStringBuilder timestamp = new ECIStringBuilder();
|
||||||
codeIndex = numericCompaction(codewords, codeIndex + 1, timestamp);
|
codeIndex = numericCompaction(codewords, codeIndex + 1, timestamp);
|
||||||
resultMetadata.setTimestamp(Long.parseLong(timestamp.toString()));
|
try {
|
||||||
|
resultMetadata.setTimestamp(Long.parseLong(timestamp.toString()));
|
||||||
|
} catch (NumberFormatException nfe) {
|
||||||
|
throw FormatException.getFormatInstance();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:
|
case MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:
|
||||||
ECIStringBuilder checksum = new ECIStringBuilder();
|
ECIStringBuilder checksum = new ECIStringBuilder();
|
||||||
codeIndex = numericCompaction(codewords, codeIndex + 1, checksum);
|
codeIndex = numericCompaction(codewords, codeIndex + 1, checksum);
|
||||||
resultMetadata.setChecksum(Integer.parseInt(checksum.toString()));
|
try {
|
||||||
|
resultMetadata.setChecksum(Integer.parseInt(checksum.toString()));
|
||||||
|
} catch (NumberFormatException nfe) {
|
||||||
|
throw FormatException.getFormatInstance();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:
|
case MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:
|
||||||
ECIStringBuilder fileSize = new ECIStringBuilder();
|
ECIStringBuilder fileSize = new ECIStringBuilder();
|
||||||
codeIndex = numericCompaction(codewords, codeIndex + 1, fileSize);
|
codeIndex = numericCompaction(codewords, codeIndex + 1, fileSize);
|
||||||
resultMetadata.setFileSize(Long.parseLong(fileSize.toString()));
|
try {
|
||||||
|
resultMetadata.setFileSize(Long.parseLong(fileSize.toString()));
|
||||||
|
} catch (NumberFormatException nfe) {
|
||||||
|
throw FormatException.getFormatInstance();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw FormatException.getFormatInstance();
|
throw FormatException.getFormatInstance();
|
||||||
|
|
Loading…
Reference in a new issue