Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SIMD header value check on char >= 0x80 #106

Merged
merged 1 commit into from
Jan 14, 2022

Conversation

eaufavor
Copy link
Contributor

The SIMD intrinsics *_cmpgt_epi8 are for signed chars.
This change correctly performs the unsigned comparison.

The SIMD intrinsics *_cmpgt_epi8 are for signed chars.
This change correctly performs the unsigned comparison.
@nox
Copy link
Contributor

nox commented Jan 13, 2022

Could you describe the problem a bit more? Why does it matter that the intrinsics are for signed chars? Is there a bug in current httparse?

@eaufavor
Copy link
Contributor Author

The intention of the code is to check if the char is greater than 0x1f. However for a char >= 0x80, *_cmpgt_epi8 treats it as negative number. So all the chars that >= 0x80 are treated as if they are <= 0x1f, which will make them to be rejected as illegal header values.

@seanmonstar seanmonstar merged commit 454efce into seanmonstar:master Jan 14, 2022
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