From: smparkes@smparkes.net Date: Tue, 31 Aug 2010 03:18:56 +0000 (+0000) Subject: Issue 524 X-Git-Url: http://git.rot13.org/?p=zxing.git;a=commitdiff_plain;h=626f0b608964ca0cdbe0a2db59731fdaf515a12e Issue 524 git-svn-id: http://zxing.googlecode.com/svn/trunk@1570 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- diff --git a/core/src/com/google/zxing/qrcode/detector/Detector.java b/core/src/com/google/zxing/qrcode/detector/Detector.java index c67b7684..e6b860b4 100644 --- a/core/src/com/google/zxing/qrcode/detector/Detector.java +++ b/core/src/com/google/zxing/qrcode/detector/Detector.java @@ -374,6 +374,9 @@ public class Detector { int alignmentAreaTopY = Math.max(0, estAlignmentY - allowance); int alignmentAreaBottomY = Math.min(image.getHeight() - 1, estAlignmentY + allowance); + if (alignmentAreaBottomY - alignmentAreaTopY < overallEstModuleSize * 3) { + throw NotFoundException.getNotFoundInstance(); + } AlignmentPatternFinder alignmentFinder = new AlignmentPatternFinder( diff --git a/cpp/core/src/zxing/qrcode/detector/Detector.cpp b/cpp/core/src/zxing/qrcode/detector/Detector.cpp index 4e40b723..fdab4292 100644 --- a/cpp/core/src/zxing/qrcode/detector/Detector.cpp +++ b/cpp/core/src/zxing/qrcode/detector/Detector.cpp @@ -273,6 +273,9 @@ Ref Detector::findAlignmentInRegion(float overallEstModuleSize } int alignmentAreaTopY = max(0, estAlignmentY - allowance); int alignmentAreaBottomY = min((int)(image_->getHeight() - 1), estAlignmentY + allowance); + if (alignmentAreaBottomY - alignmentAreaTopY < overallEstModuleSize * 3) { + throw zxing::ReaderException("region too small to hold alignment pattern"); + } AlignmentPatternFinder alignmentFinder(image_, alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize, callback_);