Repository navigation
fix string pool leak in ippSetStringfv - #226
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
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
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.
In 4be235f
ippSetStringfvwas changed to handippSetStringa pooled copy of the formatted string only for const attributes, but the condition testsIPP_TAG_CUPS_MASKinstead ofIPP_TAG_CUPS_CONST. Every value tag is non-zero under the mask, so it still always passes_cupsStrAlloc(buffer), and for normal attributesippSetStringtakes its own reference on top of that, which is never released. EachippSetStringfcall therefore leaves one string in the pool forever. ippeveprinter'srespond_ippuses it to replace an existing status-message, so an unauthenticated Print-URI withipp-attribute-fidelity=false,copies=0and an unreadabledocument-uri(first message fromrespond_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 callsippSetStringf1000 times and thenippDeleteshows 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.