Repository navigation
fix _cups_iscntrl treating UTF-8 bytes as control characters - #184
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
added a commit
that referenced
this pull request
Oct 19, 2026
Member
Contributor
Author
|
Thanks for picking this up in 730d4b7. |
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.
Commit 24ec82a replaced the
(*s & 255) < ' 'checks in json.c with the new_cups_iscntrlhelper, but the helper compares itsintargument directly and every call site hands it a plainchar. On platforms wherecharis signed (x86_64, Apple arm64) any UTF-8 byte at or above 0x80 is negative, soch < ' 'is true and the byte is classified as a control character.cupsJSONImportStringthen rejects{"name":"José"}as invalid JSON, which breaks parsing of OAuth metadata, token and userinfo responses, JWKS and JWT claims that carry a non-ASCII name, andcupsJSONExportStringwrites each such byte as�, so strings libcups stores or signs are silently corrupted. The same helper also handles the password prompt in usersys.c, the debug printf escaping in string.c and three spots in ipptool, which regressed the same way. Masking the argument to an unsigned byte inside the helper restores the pre-24ec82a behavior at every call site without touching the callers, in line with the direction you took for #177. The testjson addition imports a raw UTF-8 string, checks the value, and compares the export against the input; it fails on master with "Invalid JSON data" and passes with the fix.Assisted-by: Claude