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

UTF8StreamJsonParser: fix byte to int conversion for malformed escapes #540

Closed
wants to merge 1 commit into from
Closed

Commits on Jun 21, 2019

  1. UTF8StreamJsonParser: fix byte to int conversion

    This change ensures that the byte-to-int conversion results in a positive integer. Prior to this, the conversion could result to a negative integer when the byte was >= 0x80, which would lead to an ArrayIndexOutOfBoundsException when calling CharTypes.charToHex(ch).
    
    The issue could be reproduced with the following snippet: `factory.createParser(ObjectReadContext.empty(), "\"\\u\u0080\"".getBytes("UTF-8").nextToken()`.
    
    Traceback:
    ```
    java.lang.ArrayIndexOutOfBoundsException: -62
    	at com.fasterxml.jackson.core.io.CharTypes.charToHex(CharTypes.java:213)
    	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._decodeEscaped(UTF8StreamJsonParser.java:3606)
    	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._skipString(UTF8StreamJsonParser.java:2888)
    	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:685)
    ```
    alpire authored Jun 21, 2019
    Configuration menu
    Copy the full SHA
    2bd0d28 View commit details
    Browse the repository at this point in the history