Repository navigation
mask signed char in ctype calls in http_create and _cupsEncodeOption - #177
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
both passed a plain `char` to `isxdigit`/`isdigit`; mask with `& 255` like the rest of the code so a byte >= 0x80 isn't sign-extended to a negative int.
michaelrsweet
requested changes
Oct 13, 2026
michaelrsweet
left a comment
Member
There was a problem hiding this comment.
I think I want to update the _cups_isXXX functions to include _cups_isxdigit and _cups_isdigit so we can eliminate the masking completely.
michaelrsweet
added a commit
that referenced
this pull request
Oct 13, 2026
…ned char issues (Issue #177)
Member
michaelrsweet
added a commit
that referenced
this pull request
Oct 13, 2026
Contributor
Author
|
thanks — the internal |
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.
http_createdecides whether a hostname is a bare IPv6 literal by testing its first four bytes withisxdigit, and_cupsEncodeOptiondecides whether an integer/enum option value is numeric by testing its first byte withisdigit, both handing a plaincharstraight to the ctype function. The hostname is the connection target and the option value is whatever the caller is encoding, so either leading byte can be >= 0x80; wherecharis signed that is a negativeint, and passing anything other thanEOFor anunsigned charvalue to a ctype function is undefined behaviour, and an out-of-bounds classification-table read on libc builds whose table isn't padded for negative indices. I hit it reading the two sites next to code that already masks the same way, e.g.isspace(*end & 255)earlier inhttp.candisxdigit(src[1] & 255)inhttp-support.c. The fix adds the& 255mask the rest of the library already uses, so the result is unchanged on common libc and defined everywhere.Assisted-by: Claude Code:claude-opus-4-8