2 Commits

Author SHA1 Message Date
Jeff McGlynn
389d5016ad Add "asset" section to BoundsChecking test models
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.
2019-05-02 23:05:13 -07:00
Jeff McGlynn
8915252407 Add checks for boundary conditions for malformed glTF files
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.
2019-04-25 16:51:09 -07:00