worldturner / medeia-validator

Medeia JSON-Schema Validator
Other
56 stars 11 forks source link

Numeric value of 127 causes ArrayIndexOutOfBoundsException #14

Open FriedEgg opened 4 years ago

FriedEgg commented 4 years ago

this was seen using version 1.1.0 and not reproducible with 1.1.1

Came across a strange issue with a larger file that appears to be reproducible.

Sample Input

data.json

{
  "oneHundredTwentySevern": 127,
  "numbers": [
    126,
    127,
    128
  ]
}

schema.json

{
    "$schema": "http://json-schema.org/draft-06/schema#",
    "$ref": "#/definitions/Welcome",
    "definitions": {
        "Welcome": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "oneHundredTwentySevern": {
                    "type": "integer"
                },
                "numbers": {
                    "type": "array",
                    "items": {
                        "type": "integer"
                    }
                }
            },
            "required": [
                "numbers",
                "oneHundredTwentySevern"
            ],
            "title": "Welcome"
        }
    }
}

Log

java.lang.ArrayIndexOutOfBoundsException: 254
    at com.worldturner.medeia.parser.JsonTokenData$Companion.createNumber(JsonTokenData.kt:139)
    at com.worldturner.medeia.parser.jackson.JacksonTokenDataJsonParser.buildJsonTokenData(JacksonTokenDataJsonParser.kt:66)
    at com.worldturner.medeia.parser.jackson.JacksonTokenDataJsonParser.nextToken(JacksonTokenDataJsonParser.kt:36)
    at com.worldturner.medeia.api.jackson.MedeiaJacksonApi.parseAll(MedeiaJacksonApi.kt:65)
    at org.norc.votecast.json.tools.Validator.call(Validator.java:49)
    at org.norc.votecast.json.tools.Validator.main(Validator.java:27)