Skip to content

fix string pool leak in ippSetStringfv - #226

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

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.

This branch has not been deployed

No deployments
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.

1 participant