summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmestwa-coder <jmestwa@gmail.com>2026-06-20 19:48:02 +0300
committerGitHub <noreply@github.com>2026-06-20 19:48:02 +0300
commit7e384a7a204b1f80d8f938490be72bedd09de4b3 (patch)
tree5cf11f8eebabe4780e6c9ab81539b6bb867b1e08
parent90ba6ce264e8ad0ae984e22c172e2267ab2eb4b7 (diff)
downloadzxing-7e384a7a204b1f80d8f938490be72bedd09de4b3.tar.xz
reject non-square bit matrix in qrcode BitMatrixParser (#2096)
-rw-r--r--core/src/main/java/com/google/zxing/qrcode/decoder/BitMatrixParser.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/src/main/java/com/google/zxing/qrcode/decoder/BitMatrixParser.java b/core/src/main/java/com/google/zxing/qrcode/decoder/BitMatrixParser.java
index 229869578..8a721ef68 100644
--- a/core/src/main/java/com/google/zxing/qrcode/decoder/BitMatrixParser.java
+++ b/core/src/main/java/com/google/zxing/qrcode/decoder/BitMatrixParser.java
@@ -31,11 +31,11 @@ final class BitMatrixParser {
/**
* @param bitMatrix {@link BitMatrix} to parse
- * @throws FormatException if dimension is not >= 21 and 1 mod 4
+ * @throws FormatException if dimension is not square, or not >= 21 and 1 mod 4
*/
BitMatrixParser(BitMatrix bitMatrix) throws FormatException {
int dimension = bitMatrix.getHeight();
- if (dimension < 21 || (dimension & 0x03) != 1) {
+ if (dimension < 21 || (dimension & 0x03) != 1 || bitMatrix.getWidth() != dimension) {
throw FormatException.getFormatInstance();
}
this.bitMatrix = bitMatrix;