diff --git a/core/src/main/java/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java b/core/src/main/java/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java index 919cba17f..63ec7ccbf 100644 --- a/core/src/main/java/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java +++ b/core/src/main/java/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java @@ -321,6 +321,9 @@ final class DecodedBitStreamParser { case ECI_CHARSET: subMode = decodeTextCompaction(textCompactionData, byteCompactionData, index, result, subMode); result.appendECI(codewords[codeIndex++]); + if (codeIndex > codewords[0]) { + throw FormatException.getFormatInstance(); + } textCompactionData = new int[(codewords[0] - codeIndex) * 2]; byteCompactionData = new int[(codewords[0] - codeIndex) * 2]; index = 0;