pwgtopdf: limit bit conversion to raster row bytes - #211
Open
carrerasdarren-cell wants to merge 4 commits into
Open
pwgtopdf: limit bit conversion to raster row bytes#211carrerasdarren-cell wants to merge 4 commits into
carrerasdarren-cell wants to merge 4 commits into
Conversation
The bit conversion callbacks operate on bytes, but convert_raster passed the pixel width. For 1-bit raster rows this made invert_bits overrun the row buffer. Pass the validated byte count and add an end-to-end AddressSanitizer regression for a 128-pixel, 16-byte black raster row. Assisted-by: OpenAI Codex
Link the sanitizer harness through pkg-config so lcms2, PDFio, and the selected CUPS generation are available across the CI matrix. Assisted-by: OpenAI Codex
Run a trivial sanitized executable before the regression test so QEMU jobs that can link but cannot initialize AddressSanitizer skip cleanly. Assisted-by: OpenAI Codex
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.
Summary
Root cause
convert_raster()allocatesPixelBufferusingcupsBytesPerLine, but passed the pixel width to callbacks that iterate byte-by-byte. For the reproducer, the row is 128 pixels but only 16 bytes, soinvert_bits()accesses beyond the allocation.The callback contract now names the value as bytes and receives
bpl, matching the allocated buffer.Testing
test-pwgtopdf-bit-row.shfails with the original call under ASan and passes with this fixtest-pclm-overflow.shpassestest-pdftoraster-copy-heightpasses when run with the locally configured PDFio include/library pathsmake checkrun passes the new test and neighboring filter tests; four legacy font tests are unavailable in this local configuration because the configured font path isnoFixes #190.
Assisted-by: OpenAI Codex