mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 03:37:34 -08:00
Possible fix for https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=37853
This commit is contained in:
parent
2b48aec2c4
commit
b3941e251b
|
@ -98,13 +98,13 @@ public final class MaxiCodeReader implements Reader {
|
|||
// Now just read off the bits
|
||||
BitMatrix bits = new BitMatrix(MATRIX_WIDTH, MATRIX_HEIGHT);
|
||||
for (int y = 0; y < MATRIX_HEIGHT; y++) {
|
||||
int iy = top + (y * height + height / 2) / MATRIX_HEIGHT;
|
||||
int iy = Math.min(top + (y * height + height / 2) / MATRIX_HEIGHT, height - 1);
|
||||
for (int x = 0; x < MATRIX_WIDTH; x++) {
|
||||
// srowen: I don't quite understand why the formula below is necessary, but it
|
||||
// can walk off the image if left + width = the right boundary. So cap it.
|
||||
int ix = left + Math.min(
|
||||
(x * width + width / 2 + (y & 0x01) * width / 2) / MATRIX_WIDTH,
|
||||
width);
|
||||
width - 1);
|
||||
if (image.get(ix, iy)) {
|
||||
bits.set(x, y);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue