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 missing bounds check for JsonTreeReader.getPath() #2001

Commits on Oct 25, 2021

  1. Fix missing bounds checks for JsonTreeReader.getPath()

    There are situations where the stack of JsonTreeReader contains a JsonArray
    or JsonObject without a subsequent Iterator, for example after calling peek()
    or nextName().
    When JsonTreeReader.getPath() is called afterwards it therefore must not
    assume that a JsonArray or JsonObject is always followed by an Iterator.
    
    The only reason why this never caused an ArrayIndexOutOfBoundsException in
    the past is because the stack has an even default size (32) so it would just
    have read the next `null`.
    However, if the stack had for example the default size 31, a user created a
    JsonTreeReader for 16 JSON arrays nested inside each other, then called 15
    times beginArray(), followed by peek() and getPath() the exception would
    occur.
    Marcono1234 committed Oct 25, 2021
    Copy the full SHA
    525e14a View commit details
    Browse the repository at this point in the history