mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Possible fix for https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50388
This commit is contained in:
parent
45df470227
commit
7fe6d3c108
|
@ -257,8 +257,10 @@ final class DecodedBitStreamParser {
|
||||||
// do not include terminator
|
// do not include terminator
|
||||||
optionalFieldsLength--;
|
optionalFieldsLength--;
|
||||||
}
|
}
|
||||||
resultMetadata.setOptionalData(
|
if (optionalFieldsLength > 0) {
|
||||||
Arrays.copyOfRange(codewords, optionalFieldsStart, optionalFieldsStart + optionalFieldsLength));
|
resultMetadata.setOptionalData(Arrays.copyOfRange(codewords,
|
||||||
|
optionalFieldsStart, optionalFieldsStart + optionalFieldsLength));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return codeIndex;
|
return codeIndex;
|
||||||
|
@ -547,14 +549,14 @@ final class DecodedBitStreamParser {
|
||||||
int codeIndex,
|
int codeIndex,
|
||||||
ECIStringBuilder result) throws FormatException {
|
ECIStringBuilder result) throws FormatException {
|
||||||
boolean end = false;
|
boolean end = false;
|
||||||
|
|
||||||
while (codeIndex < codewords[0] && !end) {
|
while (codeIndex < codewords[0] && !end) {
|
||||||
//handle leading ECIs
|
//handle leading ECIs
|
||||||
while (codeIndex < codewords[0] && codewords[codeIndex] == ECI_CHARSET) {
|
while (codeIndex < codewords[0] && codewords[codeIndex] == ECI_CHARSET) {
|
||||||
result.appendECI(codewords[++codeIndex]);
|
result.appendECI(codewords[++codeIndex]);
|
||||||
codeIndex++;
|
codeIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (codeIndex >= codewords[0] || codewords[codeIndex] >= TEXT_COMPACTION_MODE_LATCH) {
|
if (codeIndex >= codewords[0] || codewords[codeIndex] >= TEXT_COMPACTION_MODE_LATCH) {
|
||||||
end = true;
|
end = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -564,7 +566,7 @@ final class DecodedBitStreamParser {
|
||||||
do {
|
do {
|
||||||
value = 900 * value + codewords[codeIndex++];
|
value = 900 * value + codewords[codeIndex++];
|
||||||
count++;
|
count++;
|
||||||
} while (count < 5 &&
|
} while (count < 5 &&
|
||||||
codeIndex < codewords[0] &&
|
codeIndex < codewords[0] &&
|
||||||
codewords[codeIndex] < TEXT_COMPACTION_MODE_LATCH);
|
codewords[codeIndex] < TEXT_COMPACTION_MODE_LATCH);
|
||||||
if (count == 5 && (mode == BYTE_COMPACTION_MODE_LATCH_6 ||
|
if (count == 5 && (mode == BYTE_COMPACTION_MODE_LATCH_6 ||
|
||||||
|
|
Loading…
Reference in a new issue