Skip to content

fix(http1): use absl::ascii_* for isUrlValid to avoid UB on signed char - #46954

Open
shoemoney wants to merge 1 commit into
envoyproxy:mainfrom
shoemoney:fix/balsa-ctype-signed
Open

fix(http1): use absl::ascii_* for isUrlValid to avoid UB on signed char#46954
shoemoney wants to merge 1 commit into
envoyproxy:mainfrom
shoemoney:fix/balsa-ctype-signed

Conversation

@shoemoney

Copy link
Copy Markdown

Fixes UB in isUrlValid (source/common/http/http1/balsa_parser.cc:111,117,136).

Bug: std::isalpha/std::isdigit/std::isalnum require unsigned char or EOF. Passing a signed char with 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.h already included). Locale-independent and defined for all char values.

Evidence: git stash RED shows std::isalpha/isdigit/isalnum at 111/117/136, GREEN shows absl::ascii_* replacements. Diff is 3 insertions, 3 deletions in one file, no formatting churn.

Written in conjunction with my pair programmer Claude.

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
shoemoney requested a deployment to external-contributors August 25, 2026 20:33 — with GitHub Actions Waiting
@repokitteh-read-only

Copy link
Copy Markdown

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.

🐱

Caused by: #46954 was opened by shoemoney.

see: more, trace.

@mathetake

Copy link
Copy Markdown
Member

/assign-from @envoyproxy/senior-maintainers

@repokitteh-read-only

Copy link
Copy Markdown

@envoyproxy/senior-maintainers assignee is @htuch

🐱

Caused by: a #46954 (comment) was created by @mathetake.

see: more, trace.

@mathetake
mathetake requested a review from htuch August 26, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants