Skip to content

Fix stack-buffer-overflow in ppdCacheCreateWithPPD()#70

Merged
tillkamppeter merged 2 commits intoOpenPrinting:masterfrom
n0y0nD:fix-stack-buffer-overflow
May 2, 2026
Merged

Fix stack-buffer-overflow in ppdCacheCreateWithPPD()#70
tillkamppeter merged 2 commits intoOpenPrinting:masterfrom
n0y0nD:fix-stack-buffer-overflow

Conversation

@n0y0nD
Copy link
Copy Markdown
Contributor

@n0y0nD n0y0nD commented Apr 10, 2026

Added a check for the return value of pwgFormatSizeName() to avoid continuing with an empty buffer.
Also added the crash PPD file (sbo_test.ppd) and a regression test in testppd.c that opens it and calls ppdCacheCreateWithPPD().
This ensures make check catches the issue if it ever breaks again. All tests are passing.
Fixes #69

Comment thread ppd/sbo_test.ppd Outdated

*% These constraints are used to test ppdConflicts() and cupsResolveConflicts()
*cupsUIConstraints envelope: "*PageSize Letter *InputSlot Envelope"
*cupsUIConstraints envelope: "*PageSize߾��ն��������ߺ���������՜�������������ߚ����������ն��������߲anual *PageSize Env10"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that this messy line is not a trigger for this bug (the invalid/out-of-range maximum custom page size dimensions are). So could you edit this line to be something readable? Or just delete this line?

Comment thread ppd/sbo_test.ppd Outdated
*PaperDimension A4: "595 842"
*PaperDimension Env10: "297 684"

*% Custom page size support
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you here tell with a comment that we use invalid/out-of-range maximum paper dimensions to trigger the bug?

@tillkamppeter tillkamppeter merged commit cdd7302 into OpenPrinting:master May 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stack-buffer-overflow in ppdCacheCreateWithPPD()

2 participants