Update tiny_gltf.h

Fixed `Windows.h` MINMAX error and reverted to original numeric limits of type `uint32_t`
This commit is contained in:
rhiskey 2023-12-04 16:57:36 +03:00 committed by GitHub
parent 30ec815748
commit 03b3a31e02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.";