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

ArrayIndexOutOfBoundsException: 200 on numbers with more than 200 digits. #157

Closed
larsp opened this issue Oct 8, 2014 · 4 comments
Closed
Milestone

Comments

@larsp
Copy link

larsp commented Oct 8, 2014

On a simple data structure such as

{  
   "values":{  
      "datatypes":{  
         "test":999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
      }
   }
}

Where the field values is a Map<String, ?>

I'll get a ArrayIndexOutOfBoundsException: 200 when the number has more than 200 digits.

Stacktrace:

Caused by: java.lang.ArrayIndexOutOfBoundsException: 200
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._parsePosNumber(UTF8StreamJsonParser.java:1216) ~[com.fasterxml.jackson.core.jackson-core_2.4.3.jar:2.4.3]
    at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:726) ~[com.fasterxml.jackson.core.jackson-core_2.4.3.jar:2.4.3]
    at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer$Vanilla.deserialize(UntypedObjectDeserializer.java:429) ~[com.fasterxml.jackson.core.jackson-databind_2.4.3.jar:2.4.3]
    at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringMap(MapDeserializer.java:451) ~[com.fasterxml.jackson.core.jackson-databind_2.4.3.jar:2.4.3]
@cowtowncoder
Copy link
Member

Thanks, sounds like some bounds check is off.

@cowtowncoder cowtowncoder added this to the 2.4.4 milestone Oct 8, 2014
@cowtowncoder
Copy link
Member

Actually, sort of; when calculating max bound, was forgetting to account for one character already appended. So was OBO problem.

Also: was a regression between 2.3->2.4 (due to low-level optimizations in squeezing out some more speed); meaning that 2.3.x was NOT affected, just 2.4.

@larsp
Copy link
Author

larsp commented Oct 9, 2014

Thanks!
To cite my favorite computer science joke: "The two most common problems in computer science are: Off by one errors"

@cowtowncoder
Copy link
Member

Indeed!

But I have realized that cost of trying out tons of low-level optimization with 2.4 was non-trivial. I over-estimated coverage of test suite; there have been almost half a dozen cases similar cases.
Could be worse however; I think all have been array-out-of-bounds, and none actual data corruption (skipping a digit or such).

Anyway, here's hoping that we are done with finding obscure regressions. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants