Repository navigation
Conversation
Short data at a low security level was encoded in 2 rows, which ISO/IEC 15438 does not allow (a symbol has 3 to 90 rows), so readers could not find the symbol. Raise minRows to 3 and pad the codewords to fill all rows of the chosen size.
danielwhite
self-requested a review
October 26, 2026 11:04
Collaborator
|
@wleeaf, thanks for the report. This was on my radar, but was scheduled behind further regression testing to land this week in preparation for a v1.2.0 release. I'll follow up once that's complete and take a closer look. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pdf417.Encodeputs short data at a low security level into a symbol with only 2 rows, for exampleEncode("A", 0),Encode("A", 1)andEncode("Hell", 0). ISO/IEC 15438 allows 3 to 90 rows, and readers don't find 2-row symbols: zxing-cpp, ZXing (Java) and rxing all fail on them.This raises
minRowsto 3. A message that would fit in fewer rows now gets the 3-row, 2-column fallback size, sogetPaddingpads tocolumns * rowscodewords instead of to the next multiple ofcolumns. For every size the search loop picks, the two amounts are the same, so other symbols don't change.TestMinimumRowsencodes short strings at security levels 0 to 2 and checks the row count. On master it fails for 7 of them, which come out with 2 rows.go test ./...,go vet ./...andgolangci-lint runpass.I also decoded 910 PDF417 symbols with zxing-cpp: digits, text and alphanumerics of lengths 1 to 300 at security levels 0, 2 and 5, plus a few special inputs. On master 6 of them are not found. With this change all of them decode to the input, and ZXing (Java) and rxing read all 910 as well.