From 03b3a31e028b638493b1fb0b4bbfafc41556a6b3 Mon Sep 17 00:00:00 2001 From: rhiskey <35545041+rhiskey@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:57:36 +0300 Subject: [PATCH] Update tiny_gltf.h Fixed `Windows.h` MINMAX error and reverted to original numeric limits of type `uint32_t` --- tiny_gltf.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tiny_gltf.h b/tiny_gltf.h index 795c513..cd86ce0 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -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::max()) { // Do not allow 4GB or more GLB data. if (err) { (*err) = "Invalid glTF binary. GLB data exceeds 4GB.";