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 infinite loop due to integer overflow when reading large strings #1350

Closed
wants to merge 3 commits into from

Commits on Oct 21, 2024

  1. Fix infinite loop due to integer overflow when reading large strings

    If the StreamReadConstraints are set to Integer.MAX_VALUE, reading a string results in an infinite loop due to the value of max overflowing to a negative value. while (ptr < max) is always false so break ascii_loop is never reached.
    
    This change uses Math.addExact to throw an ArthimeticException if an overflow were to occur and sets max to max integer, allowing the loop to break and large strings to be properly deserialized.
    adamjshook authored Oct 21, 2024
    Configuration menu
    Copy the full SHA
    19fa4b8 View commit details
    Browse the repository at this point in the history
  2. Add TestLargeString.java

    adamjshook authored Oct 21, 2024
    Configuration menu
    Copy the full SHA
    0c96b0a View commit details
    Browse the repository at this point in the history

Commits on Oct 22, 2024

  1. Configuration menu
    Copy the full SHA
    f6034ce View commit details
    Browse the repository at this point in the history