projects
/
zxing.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Guess of a fix at array index out of bounds problem observed in the wild
[zxing.git]
/
core
/
src
/
com
/
google
/
zxing
/
qrcode
/
detector
/
Detector.java
diff --git
a/core/src/com/google/zxing/qrcode/detector/Detector.java
b/core/src/com/google/zxing/qrcode/detector/Detector.java
index
ee72440
..
9807177
100644
(file)
--- a/
core/src/com/google/zxing/qrcode/detector/Detector.java
+++ b/
core/src/com/google/zxing/qrcode/detector/Detector.java
@@
-263,13
+263,13
@@
public class Detector {
// "to" should the be the first value not included, so, the first value off
// the edge is -1
otherToX = -1;
// "to" should the be the first value not included, so, the first value off
// the edge is -1
otherToX = -1;
- } else if (otherToX >
=
image.getWidth()) {
+ } else if (otherToX > image.getWidth()) {
otherToX = image.getWidth();
}
int otherToY = fromY - (toY - fromY);
if (otherToY < 0) {
otherToY = -1;
otherToX = image.getWidth();
}
int otherToY = fromY - (toY - fromY);
if (otherToY < 0) {
otherToY = -1;
- } else if (otherToY >
=
image.getHeight()) {
+ } else if (otherToY > image.getHeight()) {
otherToY = image.getHeight();
}
result += sizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY);
otherToY = image.getHeight();
}
result += sizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY);
@@
-326,6
+326,9
@@
public class Detector {
if (error > 0) {
y += ystep;
error -= dx;
if (error > 0) {
y += ystep;
error -= dx;
+ if (y == toY) {
+ break;
+ }
}
}
int diffX = toX - fromX;
}
}
int diffX = toX - fromX;