Commit Graph

14 Commits

Author SHA1 Message Date
Syoyo Fujita
eb0ecc916c Add regression test for issue 321 2021-04-29 16:04:52 +09:00
Syoyo Fujita
3fb8ffd063 Renamed directory name. 2020-07-14 22:04:26 +09:00
Syoyo Fujita
f1b536d4a9 Add scene date for issue 280 2020-07-14 22:02:51 +09:00
Syoyo Fujita
67c27aa091 Fix existing "extensions" were overwritten in serialization when the scene contains lights(serialized as "KHR_light_punctual")
Append "KHR_light_punctual" to `extensionsUsed` if not exist in serialization.
Apply clang-format.
Fixes #261
2020-05-15 21:32:06 +09:00
Syoyo Fujita
77e876f188 Possible fix for error: invalid path 'models/CubeImageUriSpaces/ 2x2 image has multiple spaces.png ' on Windows(NTFS? dislikes extra white space after the file extension ) 2020-01-17 16:15:03 +09:00
Frank Galligan
d2cdff2070 Fix loading images with spaces on Linux
This change quotes the string before it is passed into wordexp.

This addresses issue https://github.com/syoyo/tinygltf/issues/236
2020-01-13 15:06:56 -08:00
Syoyo Fujita
b0fd588748 Now material is parsed as a struct with explicit parameter definitions.
Implement Material struct serialization.
2019-07-24 19:26:48 +09:00
Jeff McGlynn
f1819b947d 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
469e039169 Parse integers directly instead of casting doubles
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.
2019-04-26 17:20:50 -07:00
Jeff McGlynn
38657337fc 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
Syoyo Fujita
48b6826198 Serialize extension with empty object. Fixes #97
Use pretty printing JSON when serializing for the readability.
2018-10-08 21:18:33 +09:00
Syoyo Fujita
d7423bad31 Consider Data URI buffers in binary. Fixes #79. 2018-07-11 02:46:52 +09:00
Syoyo Fujita
4de15d04c7 Remove unused examples.
Refactor source code.
2017-06-04 17:42:41 +09:00
Syoyo Fujita
95f412ee6b Add Cube test model. 2017-05-27 23:55:32 +09:00