fix(http1): use absl::ascii_* for isUrlValid to avoid UB on signed char - #46954
Open
shoemoney wants to merge 1 commit into
Open
fix(http1): use absl::ascii_* for isUrlValid to avoid UB on signed char#46954shoemoney wants to merge 1 commit into
shoemoney wants to merge 1 commit into
Conversation
Fix verified RED->GREEN. http1: unsafe ctype on signed char in balsa_parser.cc isUrlValid at 111,117,136 - std::isalpha/isdigit/isalnum require unsigned char or EOF, passing negative on byte >=0x80 is UB from untrusted Request-URI Signed-off-by: Jeremy Schoemaker <jeremy@shoemoney.com>
shoemoney
requested a deployment
to
external-contributors
August 25, 2026 20:33 — with
GitHub Actions
Waiting
|
Hi @shoemoney, welcome and thank you for your contribution. We will try to review your Pull Request as quickly as possible. In the meantime, please take a look at the contribution guidelines if you have not done so already. |
Member
|
/assign-from @envoyproxy/senior-maintainers |
|
@envoyproxy/senior-maintainers assignee is @htuch |
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.
Fixes UB in
isUrlValid(source/common/http/http1/balsa_parser.cc:111,117,136).Bug:
std::isalpha/std::isdigit/std::isalnumrequireunsigned charorEOF. Passing a signedcharwith value >= 0x80 from an untrusted Request-URI is undefined behavior.Fix: Replace 3 sites with
absl::ascii_isalpha/absl::ascii_isdigit/absl::ascii_isalnum(absl/strings/ascii.halready included). Locale-independent and defined for allcharvalues.Evidence:
git stashRED showsstd::isalpha/isdigit/isalnumat 111/117/136, GREEN showsabsl::ascii_*replacements. Diff is 3 insertions, 3 deletions in one file, no formatting churn.Written in conjunction with my pair programmer Claude.