diff --git a/cpp/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.cpp b/cpp/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.cpp index d209d939c..b3571ed7b 100644 --- a/cpp/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.cpp +++ b/cpp/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.cpp @@ -364,6 +364,9 @@ DecodedBitStreamParser::decode(ArrayRef bytes, // We do little with FNC1 except alter the parsed result a bit according to the spec fc1InEffect = true; } else if (mode == &Mode::STRUCTURED_APPEND) { + if (bits.available() < 16) { + throw new FormatException(); + } // not really supported; all we do is ignore it // Read next 8 bits (symbol sequence #) and 8 bits (parity data), then continue bits.readBits(16);