These test assets were trimmed down and erroneously didn't have an
"asset" section or version number, which is required by the glTF spec.
This fixes test failures with pull request #162.
When parsing numeric values as doubles, its possible for users to
specify values that cannot be converted to integers, such as Inf, NaN,
and extremes such as 1e100. If this value is received, and then cast to
an int, it is undefined behavior, which trips ubsan when running
tinygltf under a fuzzer.
Instead of parsing integral values as doubles, use nlohmann/json's
built-in support to parse integer and unsigned values directly, with
.is_number_integer() and .is_number_unsigned().
Add ParseIntegerProperty, ParseUnsignedProperty, and
ParseIntegerArrayProperty helpers that allow parsing directly to
int/uint values and update code to use them when appropriate.
When loading untrusted glTF files, ideally an error should be returned
if the file is malformed instead of an exception/crash. Add additional
validation for crashes found when running tinygltf under a fuzzer, and
add test cases to confirm:
1. Validate that the primitive indices value is within the
model->accessors bounds before dereferencing.
2. Validate that the accessors bufferView index if valid.
3. Validate that the buffer's index is valid when parsing images.
4. For glb files, validate that the overall length is within the
provided input buffer.