Skip to content

fix string pool leak in ippSetStringfv - #226

Closed
tanjiroK-coder wants to merge 1 commit into
OpenPrinting:masterfrom
tanjiroK-coder:ipp-setstringfv-pool-leak
Closed

tanjiroK-coder wants to merge 1 commit into
OpenPrinting:masterfrom
tanjiroK-coder:ipp-setstringfv-pool-leak

Conversation

@tanjiroK-coder

Copy link
Copy Markdown
Contributor

In 4be235f ippSetStringfv was changed to hand ippSetString a pooled copy of the formatted string only for const attributes, but the condition tests IPP_TAG_CUPS_MASK instead of IPP_TAG_CUPS_CONST. Every value tag is non-zero under the mask, so it still always passes _cupsStrAlloc(buffer), and for normal attributes ippSetString takes its own reference on top of that, which is never released. Each ippSetStringf call therefore leaves one string in the pool forever. ippeveprinter's respond_ipp uses it to replace an existing status-message, so an unauthenticated Print-URI with ipp-attribute-fidelity=false, copies=0 and an unreadable document-uri (first message from respond_ignored, second is "Unable to access URI '%s'" with the client's URI) leaks up to 1 KB per request with a distinct URI. A harness that calls ippSetStringf 1000 times and then ippDelete shows 1000 pooled strings left before the change and none after, and const attributes still get a pooled copy (clean under ASan). The new testipp case fails on the current tree and passes with the fix.

ippSetStringfv tested IPP_TAG_CUPS_MASK instead of IPP_TAG_CUPS_CONST,
so it always passed a _cupsStrAlloc'd copy of the formatted string to
ippSetString, which takes its own reference for non-const attributes.
The extra reference was never released.  Only pass a pooled copy for
const attributes and add a testipp regression.

@michaelrsweet michaelrsweet left a comment

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 don't want the added string pool testing as it will break every time we make a change to the IPP tests.

@michaelrsweet michaelrsweet self-assigned this Nov 22, 2026
@michaelrsweet michaelrsweet added the bug Something isn't working label Nov 22, 2026
@michaelrsweet michaelrsweet added this to the Stable milestone Nov 22, 2026
@michaelrsweet

Copy link
Copy Markdown
Member

[master a0687e7] Fix regression in ippSetStringfv (Issue #226)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants