Repository navigation
reject jobs exceeding XFORM_MAX_PAGES in ipptransform - #194
Open
tanjiroK-coder wants to merge 1 commit into
Open
tanjiroK-coder wants to merge 1 commit into
tanjiroK-coder wants to merge 1 commit into
Conversation
prepare_pages() walks the fixed-size p.outpages[XFORM_MAX_PAGES] array without a bounds check, so a document with more than 10000 pages writes past the end of the array. Reject such jobs in prepare_documents before laying out pages.
michaelrsweet
requested changes
Oct 23, 2026
michaelrsweet
left a comment
Member
There was a problem hiding this comment.
The number of input pages is not always the same as the number of output pages - "number-up" and "imposition-template" can map multiple input pages to a single output page, for example.
This branch has not been deployed
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.
Out-of-bounds write in
prepare_pageson documents with many pagesprepare_pageswrites onep.outpages[]entry per output page but never checks the running index against the array's fixed size (XFORM_MAX_PAGES, 10000). The output page count never exceeds the input page count, which is summed from each document'spdfioFileGetNumPages, so a job whose document holds more than 10000 pages walksoutpagepast the end of the array and writesoutpage->pdfandoutpage->input[...]out of bounds.ipptransformis the IPP Everywhere transform run on client-submitted documents, throughippeveprinterand directly, so the page count is attacker-controlled.The check lives in
prepare_documentsright after the per-document page totals are known, so an oversized job is refused before any layout happens. Jobs up to 10000 pages behave exactly as before.I could not run
make testin my environment (no OpenSSL or GnuTLS available), so I confirmed the write with an AddressSanitizer harness that mirrors theprepare_pagesloop over anoutpages[XFORM_MAX_PAGES]array (the harness heap-allocates the prepare struct): a 10001-page input reports an out-of-bounds WRITE one element past the array, exactly 10000 pages stays clean, and the new check prevents the overflow.