mirror of
https://github.com/zxing/zxing.git
synced 2024-09-20 05:27:32 -07:00
Issue 1736 reject UPC/EAN less than 8 chars
git-svn-id: https://zxing.googlecode.com/svn/trunk@2871 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
5fd33bb9d2
commit
a582958cc3
|
@ -176,6 +176,10 @@ public abstract class UPCEANReader extends OneDReader {
|
|||
}
|
||||
|
||||
String resultString = result.toString();
|
||||
// UPC/EAN should never be less than 8 chars anyway
|
||||
if (resultString.length() < 8) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
if (!checkChecksum(resultString)) {
|
||||
throw ChecksumException.getChecksumInstance();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <zxing/oned/OneDResultPoint.h>
|
||||
#include <zxing/ReaderException.h>
|
||||
#include <zxing/NotFoundException.h>
|
||||
#include <zxing/FormatException.h>
|
||||
#include <zxing/ChecksumException.h>
|
||||
|
||||
using std::vector;
|
||||
|
@ -31,6 +32,7 @@ using std::string;
|
|||
using zxing::Ref;
|
||||
using zxing::Result;
|
||||
using zxing::NotFoundException;
|
||||
using zxing::FormatException;
|
||||
using zxing::ChecksumException;
|
||||
using zxing::oned::UPCEANReader;
|
||||
|
||||
|
@ -138,6 +140,11 @@ Ref<Result> UPCEANReader::decodeRow(int rowNumber,
|
|||
throw NotFoundException();
|
||||
}
|
||||
|
||||
// UPC/EAN should never be less than 8 chars anyway
|
||||
if (result.length() < 8) {
|
||||
throw FormatException();
|
||||
}
|
||||
|
||||
Ref<String> resultString (new String(result));
|
||||
if (!checkChecksum(resultString)) {
|
||||
throw ChecksumException();
|
||||
|
|
Loading…
Reference in a new issue