Repository navigation
retain language per value in ippSetValueTag - #220
Closed
tanjiroK-coder wants to merge 1 commit into
Closed
tanjiroK-coder wants to merge 1 commit into
tanjiroK-coder wants to merge 1 commit into
Conversation
michaelrsweet
left a comment
Member
There was a problem hiding this comment.
I don't see the need to add a unit test for this... Definitely an edge-case (not aware of any code that actually calls ippSetValueTag to convert from name/textWithoutLanguage to name/textWithLanguage) and there is currently no way to set the language after attribute creation.
michaelrsweet
added a commit
that referenced
this pull request
Nov 19, 2026
… other fixes (Issue #220)
Member
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.
Since 4be235f, ipp_free_values releases the language of every nameWithLanguage/textWithLanguage value, but ippSetValueTag still converts a multi-valued name/keyword/text attribute by taking a single _cupsStrAlloc reference for values[0] and copying that pointer into the other values. Deleting the converted attribute then drops the pooled language string once per value, so with three values the "en" pool entry that attributes-natural-language also references is freed while that attribute still points at it. AddressSanitizer reports a heap-use-after-free in compare_sp_items via _cupsStrFree from ipp_free_values (ippDeleteAttribute), with the freed block being the attributes-natural-language string allocated by ippAddString. I found it while checking the remaining places that share values[0].string.language after the #215 change. Taking a reference per value matches what ippAddStrings, ippCopyAttribute and ippSetString now do. The same block always set the tag to nameWithLanguage, so a text to textWithLanguage conversion came back as nameWithLanguage; it now uses the requested tag. The new testipp case converts 3-valued name and text attributes and deletes them: it hits the use-after-free under ASan on the current tree and passes with the fix.