Skip to content

Commit 34fcdbe

Browse files
authored
Merge pull request #87 from dmuir/master
Fix integer overflow detected by fuzz test.
2 parents 4fba88b + 10e2913 commit 34fcdbe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cgltf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1711,7 +1711,7 @@ cgltf_size cgltf_accessor_read_index(const cgltf_accessor* accessor, cgltf_size
17111711
#define CGLTF_CHECK_TOKTYPE(tok_, type_) if ((tok_).type != (type_)) { return CGLTF_ERROR_JSON; }
17121712
#define CGLTF_CHECK_KEY(tok_) if ((tok_).type != JSMN_STRING || (tok_).size == 0) { return CGLTF_ERROR_JSON; } /* checking size for 0 verifies that a value follows the key */
17131713

1714-
#define CGLTF_PTRINDEX(type, idx) (type*)(cgltf_size)(idx + 1)
1714+
#define CGLTF_PTRINDEX(type, idx) (type*)((cgltf_size)idx + 1)
17151715
#define CGLTF_PTRFIXUP(var, data, size) if (var) { if ((cgltf_size)var > size) { return CGLTF_ERROR_JSON; } var = &data[(cgltf_size)var-1]; }
17161716
#define CGLTF_PTRFIXUP_REQ(var, data, size) if (!var || (cgltf_size)var > size) { return CGLTF_ERROR_JSON; } var = &data[(cgltf_size)var-1];
17171717

0 commit comments

Comments
 (0)