Skip to content

Commit

Permalink
Merge pull request #467 from rhiskey/release
Browse files Browse the repository at this point in the history
Small security and overflow patch
  • Loading branch information
syoyo authored Dec 4, 2023
2 parents 8387fdb + 8fdeca1 commit 6782f88
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion stb_image_write.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__
len = sprintf_s(buffer, sizeof(buffer), "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x);
#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
s->func(s->context, buffer, len);

Expand Down
2 changes: 1 addition & 1 deletion tiny_gltf.h
Original file line number Diff line number Diff line change
Expand Up @@ -6669,7 +6669,7 @@ 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 > 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.
if (err) {
(*err) = "Invalid glTF binary. GLB data exceeds 4GB.";
Expand Down

0 comments on commit 6782f88

Please sign in to comment.