-
-
Notifications
You must be signed in to change notification settings - Fork 15.8k
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
StringIndexOutOfBoundsException caused by empty content value #11408
Milestone
Comments
NiteshKant
pushed a commit
to NiteshKant/netty
that referenced
this issue
Jun 22, 2021
__Motivation__ `HttpUtil#normalizeAndGetContentLength()` throws `StringIndexOutOfBoundsException` for empty `content-length` values, it should instead throw `IllegalArgumentException` for all invalid values. __Modification__ - Throw `IllegalArgumentException` if the `content-length` value is empty. - Add tests __Result__ Fixes netty#11408
Thanks for the report @togetsukyo , here is the PR for the fix: #11409 |
normanmaurer
pushed a commit
that referenced
this issue
Jun 23, 2021
…11409) __Motivation__ `HttpUtil#normalizeAndGetContentLength()` throws `StringIndexOutOfBoundsException` for empty `content-length` values, it should instead throw `IllegalArgumentException` for all invalid values. __Modification__ - Throw `IllegalArgumentException` if the `content-length` value is empty. - Add tests __Result__ Fixes #11408
normanmaurer
pushed a commit
that referenced
this issue
Jun 23, 2021
…11409) __Motivation__ `HttpUtil#normalizeAndGetContentLength()` throws `StringIndexOutOfBoundsException` for empty `content-length` values, it should instead throw `IllegalArgumentException` for all invalid values. __Modification__ - Throw `IllegalArgumentException` if the `content-length` value is empty. - Add tests __Result__ Fixes #11408
raidyue
pushed a commit
to raidyue/netty
that referenced
this issue
Jul 8, 2022
…etty#11409) __Motivation__ `HttpUtil#normalizeAndGetContentLength()` throws `StringIndexOutOfBoundsException` for empty `content-length` values, it should instead throw `IllegalArgumentException` for all invalid values. __Modification__ - Throw `IllegalArgumentException` if the `content-length` value is empty. - Add tests __Result__ Fixes netty#11408
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Actual behavior
A recent commit causing this line to throw exception if we've got empty content-length header:
Stack trace:
Expected behavior
It should gracefully handle the StringIndexOutOfBoundsException and throw exception saying that Content-Length header is invalid.
Steps to reproduce
This can be easily reproduced by the following test code:
Minimal yet complete reproducer code (or URL to code)
Netty version
4.1.63.Final
JVM version (e.g.
java -version
)OS version (e.g.
uname -a
)The text was updated successfully, but these errors were encountered: