Skip to content

Commit

Permalink
Update tiny_gltf.h
Browse files Browse the repository at this point in the history
Fixed `Windows.h` MINMAX error and reverted to original numeric limits of type `uint32_t`
  • Loading branch information
rhiskey authored Dec 4, 2023
1 parent 30ec815 commit 03b3a31
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tiny_gltf.h
Original file line number Diff line number Diff line change
Expand Up @@ -6669,7 +6669,8 @@ bool TinyGLTF::LoadBinaryFromMemory(Model *model, std::string *err,
// Use 64bit uint to avoid integer overflow.
uint64_t header_and_json_size = 20ull + uint64_t(chunk0_length);

if (header_and_json_size > sizeof(uint64_t)) {
#undef max
if (header_and_json_size > std::numeric_limits<uint32_t>::max()) {
// Do not allow 4GB or more GLB data.
if (err) {
(*err) = "Invalid glTF binary. GLB data exceeds 4GB.";
Expand Down

0 comments on commit 03b3a31

Please sign in to comment.