Generate proper FormatException on QR code with bad structured append segment

C++ port of http://code.google.com/p/zxing/source/detail?r=2367 /
http://code.google.com/p/zxing/issues/detail?id=1324

git-svn-id: https://zxing.googlecode.com/svn/trunk@2484 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
smparkes@smparkes.net 2012-10-29 18:48:55 +00:00
parent d7b0f2cb82
commit 3e1491d850

View file

@ -364,6 +364,9 @@ DecodedBitStreamParser::decode(ArrayRef<unsigned char> 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);