mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-07-13 03:21:47 +08:00
Merge pull request #467 from rhiskey/release
Small security and overflow patch
This commit is contained in:
commit
6782f887bb
@ -773,7 +773,7 @@ static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, f
|
|||||||
#ifdef __STDC_LIB_EXT1__
|
#ifdef __STDC_LIB_EXT1__
|
||||||
len = sprintf_s(buffer, sizeof(buffer), "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
|
len = sprintf_s(buffer, sizeof(buffer), "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
|
||||||
#else
|
#else
|
||||||
len = sprintf(buffer, "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
|
len = snprintf(buffer, sizeof(buffer), "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
|
||||||
#endif
|
#endif
|
||||||
s->func(s->context, buffer, len);
|
s->func(s->context, buffer, len);
|
||||||
|
|
||||||
|
@ -6669,7 +6669,7 @@ bool TinyGLTF::LoadBinaryFromMemory(Model *model, std::string *err,
|
|||||||
// Use 64bit uint to avoid integer overflow.
|
// Use 64bit uint to avoid integer overflow.
|
||||||
uint64_t header_and_json_size = 20ull + uint64_t(chunk0_length);
|
uint64_t header_and_json_size = 20ull + uint64_t(chunk0_length);
|
||||||
|
|
||||||
if (header_and_json_size > std::numeric_limits<uint32_t>::max()) {
|
if (header_and_json_size > (std::numeric_limits<uint32_t>::max)()) {
|
||||||
// Do not allow 4GB or more GLB data.
|
// Do not allow 4GB or more GLB data.
|
||||||
if (err) {
|
if (err) {
|
||||||
(*err) = "Invalid glTF binary. GLB data exceeds 4GB.";
|
(*err) = "Invalid glTF binary. GLB data exceeds 4GB.";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user