summaryrefslogtreecommitdiff
path: root/core/src/test
AgeCommit message (Collapse)AuthorFilesLines
2026-07-12reject bit matrix not matching layer count in aztec extractBits (#2117)jmestwa-coder1-0/+17
2026-07-09Address Issue #2115, Aztec grid (#2116)Sean Owen1-0/+30
2026-07-07reject non-positive datablock count in aztec correctBits (#2114)jmestwa-coder1-0/+19
2026-06-26reject negative and overflowing crop in core LuminanceSource classes (#2112)jmestwa-coder2-0/+20
the crop constructors in PlanarYUVLuminanceSource and GrayscaleLuminanceSource did not reject negative offsets or sizes and overflowed when checking left+width and top+height, letting an out-of-bounds crop reach getRow and getMatrix; validate the rectangle the same way as BufferedImageLuminanceSource.
2026-06-24fix quadratic backtracking in URIResultParser isPossiblyMaliciousURI (#2110)jmestwa-coder1-0/+14
2026-06-23use anchored matching in URIResultParser.isBasicallyValidURI (#2109)jmestwa-coder1-0/+11
2026-06-22Clear padding bits in BitMatrix.flip() so they are not read as set (#2108)Vasiliy Mikhailov1-0/+34
BitMatrix.flip() inverted every int in bits[], including the unused padding bits beyond the logical width in each rows last int. Methods that scan the raw bits (getTopLeftOnBit/getBottomRightOnBit/getEnclosingRectangle/equals) then treated those stray bits as part of the matrix, e.g. getBottomRightOnBit() returning (31,4) instead of (4,4) on a 5x5 matrix. Mask off the padding after flipping. Adds a regression test.
2026-06-22guard truncated structured carrier message in maxicode decode (#2106)jmestwa-coder1-0/+22
2026-06-21format decoded digits locale-independently in maxicode/pdf417/aztec (#2100)jmestwa-coder2-0/+42
2026-06-21fix catastrophic backtracking in email domain regex (#2099)jmestwa-coder1-0/+11
2026-06-20reject wrong-size bit matrix in maxicode BitMatrixParser (#2098)jmestwa-coder1-0/+63
2026-06-20reject oversized received array in pdf417 ErrorCorrection.decode (#2097)jmestwa-coder1-0/+15
2026-06-16guard empty symbol in code39 check digit handling (#2092)jmestwa-coder1-0/+18
2026-06-15avoid NegativeArraySizeException in aztec getEncodedData (#2091)jmestwa-coder1-0/+7
2026-06-13guard truncated symbol in rss expanded AI01AndOtherAIs decoder (#2089)jmestwa-coder1-0/+37
2026-06-12guard unterminated AI in ExpandedProductResultParser (#2088)jmestwa-coder1-0/+10
2026-06-05guard trailing shift char in code39 decodeExtended (#2086)jmestwa-coder1-0/+20
2026-06-05avoid out-of-bounds reads after control codewords in pdf417 parser (#2085)jmestwa-coder1-0/+32
2026-06-03guard base256 length read in datamatrix decodeBase256Segment (#2084)jmestwa-coder1-0/+9
2026-05-27Avoid charset provider lookups for UTF-8 QR encoding (#2077)Mygod1-0/+64
* Avoid charset provider lookups for UTF-8 QR encoding * Simplify charset lookup handling
2026-05-01Add reader initialization support for Data Matrix and PDF417 (#2069)Daniel Gredler10-8/+14
2026-05-01Add Code 128 reader initialization support (#2068)Daniel Gredler6-2/+6
2026-04-30Add Aztec reader initialization support (#2066)Daniel Gredler9-4/+21
2026-04-08Fix QR decode failure for small/native-size images (#2061)Andrew Szeto2-0/+66
* Fix QR decode failure for small/native-size images (#1976) QRCodeWriter.encode(..., 0, 0) produces a 33x33 native-size QR that ZXing cannot decode. The CENTER_QUORUM filter in selectBestPatterns() (added in 110ef9e to fix #1567) removes finder patterns with count < 2. For small images, the row-skip interval (iSkip=3, MIN_SKIP) means the scanner only crosses the top two finder pattern centers on a single row each, giving them count=1. The bottom-left pattern gets count=2 because it's scanned after iSkip drops to 2. The filter then removes the two count=1 patterns, leaving 1 of the 3 needed, and throws NotFoundException. The fix: only apply the CENTER_QUORUM filter when either (a) at least 3 confirmed patterns would survive, or (b) the total candidate list exceeds a size threshold. This preserves #1567 protection while allowing small images through. Why a size threshold: the filter was added to prevent O(n^3) blowup in the triangle-selection loop when noisy images produce thousands of spurious candidates. When the candidate list is small (<= 25 entries, yielding <= ~2300 loop iterations), the cubic cost is negligible regardless of whether the patterns are real or spurious. A clean single-QR image produces ~3 candidates; even a noisy image below the threshold is computationally trivial. Above the threshold, the filter applies unconditionally, matching today's behavior. Alternatives considered: - Removing the filter entirely: all 561 existing tests pass, but re-opens #1567 for pathological images with thousands of spurious count=1 candidates. - Reducing MIN_SKIP from 3 to 1 for small images: addresses the symptom (more scan rows = higher counts) but doesn't fix the fundamental interaction between iSkip and the quorum filter, and changes scan behavior for all small images. - Fallback (try with filter, retry without on failure): re-opens #1567 whenever fewer than 3 confirmed patterns exist, which is exactly the scenario that produces thousands of unconfirmed candidates in noisy images. * Increase noisy-image test timeout from 5s to 30s GitHub shared runners timed out at 5s. Local measurement shows ~1.2s, implying at least 4x slowdown on CI. 30s gives a comfortable margin while still catching the O(n^3) regression from #1567.
2025-11-11Loosen ITF max variance for 3x module widths (#2014)Daniel Gredler3-2/+3
2025-11-11Add GrayscaleLuminanceSource (#2013)Daniel Gredler1-0/+126
2025-11-10Add 90-degree rotation support to RGBLuminanceSource (#2012)Daniel Gredler1-0/+47
2025-07-23Add input validation for pixel array length in RGBLuminanceSource and add ↵Leo Fernandes1-0/+15
test case for regression (#1961)
2024-11-17Fixing issue #1831 (#1879)François Tiercelin1-0/+43
* throw a more explicit exception when trying to PDF417/TEXT encode something outside of 0...255 * refactor PDF417HighLevelEncoder to avoid code duplication extend UT to new method PDF417HighLevelEncoder#checkCharset * fix javadoc typo make UT more stringent on PDF417HighLevelEncoder#checkCharset * restrict TEXT to 0...127 test with CP437 and Greek chars * reinstate testEncodeAuto UT * refactor testEncodeAuto UT * address codacy findings * formatting * fix issue #1831 make PDF417#determineDimensions to enable finer UT add UT coverage to validate fix for #1831 * fix javadoc for PDF417#determineDimensions remove stacktrace when UT fails * make UT Java 8 compliant
2024-10-22PDF417: Check that input is made of 0...127 chars when using ↵François Tiercelin1-6/+94
Compaction.TEXT, throw an explicit exception if not the case (#1878) * throw a more explicit exception when trying to PDF417/TEXT encode something outside of 0...255 * refactor PDF417HighLevelEncoder to avoid code duplication extend UT to new method PDF417HighLevelEncoder#checkCharset * fix javadoc typo make UT more stringent on PDF417HighLevelEncoder#checkCharset * restrict TEXT to 0...127 test with CP437 and Greek chars * reinstate testEncodeAuto UT * refactor testEncodeAuto UT * address codacy findings * formatting
2024-10-19Be more stringent on email validation rules (#1870)François Tiercelin2-1/+27
* be more stringent on email validation rules add UT to validate various email formats * fix indentation * fix failing UT case * refine regex for email's domain: * only letters in the last part * no part starting or ending with a - (- allowed inside the part) add UT to cover such cases
2024-05-02Promote renderResult method to public (#1801)cdcarloschacon1-0/+54
This small commit makes public the "renderResult" method of the "QRCodeWriter" class. The reason to promote this method as public is that I'm facing Business Case where, besides of generating the QR code as a PNG image, I also need to print information about the QR code itself (specifically, the QR version). Navigating through the code of zxing library, I noticed that the com.google.zxing.qrcode.encoder.Encoder allows me to have that (the QR metadata); however, by invoking that class I only have part of the equation (the QRCode DTO) ... I'm still needing to generate the BitMatrix in order to produce the QR image. Here, I have two alternatives: either I invoke the Encoder.encode class by myself and repeat the same logic when invoking the QRCodeWriter.encode method; or I make the renderResult Public, call the Encoder.encode and then I proceed to call the QRCodeWriter.renderResult method with the previous result.
2023-09-16Avoid decoding stacked row 1 of N independently (#1693)Daniel Gredler3-4/+4
* Avoid decoding stacked row 1 of N independently * Avoid decoding stacked row 1 of N independently
2023-09-15Avoid 2 more RSS Expanded finder pattern false positive scenarios (#1692)Daniel Gredler5-2/+4
2023-09-04Detect RSS Expanded finder pattern false positives by checking sequences (#1680)Daniel Gredler3-2/+3
2023-07-30Fix MaxiCode handling of vertical quiet zone (#1671)Daniel Gredler4-39/+2
2023-06-26Add ResultMetadataType.ERRORS_CORRECTED and ERASURES_CORRECTED (#1657)Daniel Gredler28-23/+51
* Add ResultMetadataType.ERRORS_CORRECTED and ERASURES_CORRECTED (2D barcodes) * Maintain existing constructor on AztecDetectorResult * Maintain existing ReedSolomonDecoder.decode method
2023-05-29Use barcode-specific min height when searching for stop pattern (fixes ↵Daniel Gredler3-4/+5
#1641) (#1642)
2023-05-23Reduce PDF417 variance leniency (fixes #1624) (#1628)Daniel Gredler3-5/+6
2023-05-23Enable supported ECI charsets dynamically (#1625)Daniel Gredler1-1/+1
* Enable supported ECI charsets dynamically * Remove use of Java 9+ API * Remove property-based override for dynamic ECI charsets
2022-11-01Filter unconfirmed QR code finder patterns before testing triangles to avoid ↵Sean Owen3-3/+3
long-running analysis. Closes #1567
2022-10-20Various code tweaks, action updates, dep updatesSean Owen1-1/+0
2022-07-20Fix Maxicode decoding of CR (carriage return); fixes #1543 (#1544)Daniel Gredler3-0/+39
2022-05-06Prevent encoding of the empty string for PDF417 (#1523)AlexGeller11-0/+6
* Added code so that the PDF417 encoder throws an exception when attempting to encode the empty string
2022-03-09Add multi-eci decoding for PDF417 (#1507)AlexGeller11-15/+29
* - Added multi-eci decoding for PDF417 - Fixed issue that some multi-eci encoded PDF417 codes were missing ECIs * Syntactic changes * - Fixed issue that ECIs were not processed correctly in all allowed locations in binary encoded data as specified in section 5.5.3.2 of the spec - Added verifying unit test
2022-03-05Add support for multi-eci encoding for PDF417 (#1506)AlexGeller12-15/+128
* - Added multi-eci encoding for PDF417 - Fixed issue that the PDF417 decoder incorrectly decoded input with a leading ECI and no explicit latch to TEXT encoding
2022-03-02Adding more PDF417 decoding tests (#1504)AlexGeller11-0/+163
* Added more PDF417 decoding tests
2022-02-17Minor code changes to previous PR mergesSean Owen2-9/+8
2022-01-26Fixed IllegalArgumentException in ErrorCorrection.encodeECC200 cause by the ↵AlexGeller11-17/+29
minimal encoder not adding padding (#1496)
2022-01-20Minimal encoding for Code-128 (2nd, less intrusive version) (#1484)AlexGeller11-21/+129
* 2nd version of Code128 minimal encoding.