summaryrefslogtreecommitdiff
path: root/core/src/main/java
diff options
context:
space:
mode:
authorjmestwa-coder <jmestwa@gmail.com>2026-06-20 18:53:30 +0300
committerGitHub <noreply@github.com>2026-06-20 18:53:30 +0300
commit90ba6ce264e8ad0ae984e22c172e2267ab2eb4b7 (patch)
treeabf0b4bfc64f3e3bee8b6b89a8b6159e916913f8 /core/src/main/java
parent9172a3da2010082a6c134fa5cade5cb133aae60d (diff)
downloadzxing-90ba6ce264e8ad0ae984e22c172e2267ab2eb4b7.tar.xz
reject oversized received array in pdf417 ErrorCorrection.decode (#2097)
Diffstat (limited to 'core/src/main/java')
-rw-r--r--core/src/main/java/com/google/zxing/pdf417/decoder/ec/ErrorCorrection.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/src/main/java/com/google/zxing/pdf417/decoder/ec/ErrorCorrection.java b/core/src/main/java/com/google/zxing/pdf417/decoder/ec/ErrorCorrection.java
index 06bd06d82..a0b0a22a5 100644
--- a/core/src/main/java/com/google/zxing/pdf417/decoder/ec/ErrorCorrection.java
+++ b/core/src/main/java/com/google/zxing/pdf417/decoder/ec/ErrorCorrection.java
@@ -46,6 +46,12 @@ public final class ErrorCorrection {
int numECCodewords,
int[] erasures) throws ChecksumException {
+ if (received.length > field.getSize()) {
+ // A codeword cannot be longer than the field; otherwise erasure and error positions
+ // index past the exponent table in exp()/log().
+ throw ChecksumException.getChecksumInstance();
+ }
+
ModulusPoly poly = new ModulusPoly(field, received);
int[] S = new int[numECCodewords];
boolean error = false;