Closes #610 : avoid AIOOBE in pure-barcode mode for obviously wrong case

This commit is contained in:
Sean Owen 2016-06-20 09:20:16 +01:00
parent 5927f6ef09
commit 1a5b739cdc

View file

@ -139,6 +139,10 @@ public class QRCodeReader implements Reader {
// Special case, where bottom-right module wasn't black so we found something else in the last row
// Assume it's a square, so use height as the width
right = left + (bottom - top);
if (right >= image.getWidth()) {
// Abort if that would not make sense -- off image
throw NotFoundException.getNotFoundInstance();
}
}
int matrixWidth = Math.round((right - left + 1) / moduleSize);