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

Jetty 9.4.x : fix tries mistakenly throwing ArrayIndexOutOfBoundsException #7503

Merged
merged 11 commits into from
Feb 1, 2022

Conversation

lorban
Copy link
Contributor

@lorban lorban commented Jan 31, 2022

  • Add missing ByteBuffer limit checks in get() and getBest() to make sure that ArrayIndexOutOfBoundsException is never going to be thrown.
  • Never write an index that points out of the array in put() by always incrementing the row count before checking the limit but capping it at its max value.
  • Make sure the row count cannot overflow Character.MAX_VALUE.

gregw and others added 2 commits January 31, 2022 16:31
Test to show exception on getBest after overflow

Signed-off-by: Greg Wilkins <gregw@webtide.com>
…tries

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@lorban lorban self-assigned this Jan 31, 2022
@lorban lorban added the Bug For general bugs on Jetty side label Jan 31, 2022
…ookups overflow

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@lorban lorban marked this pull request as draft January 31, 2022 18:04
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
gregw and others added 3 commits February 1, 2022 11:08
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@lorban lorban requested a review from gregw February 1, 2022 09:46
@lorban lorban marked this pull request as ready for review February 1, 2022 10:02
@sbordet sbordet merged commit 09f4899 into jetty-9.4.x Feb 1, 2022
@sbordet sbordet deleted the jetty-9.4.x-7496-Trie-Overflow branch February 1, 2022 12:33
@lorban lorban linked an issue Feb 1, 2022 that may be closed by this pull request
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (I know too late if it didn't :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transient 400: Bad Request responses
4 participants