mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Updated cgltf.
This commit is contained in:
6
3rdparty/cgltf/cgltf.h
vendored
6
3rdparty/cgltf/cgltf.h
vendored
@@ -1147,7 +1147,7 @@ cgltf_result cgltf_parse(const cgltf_options* options, const void* data, cgltf_s
|
||||
// JSON chunk: length
|
||||
uint32_t json_length;
|
||||
memcpy(&json_length, json_chunk, 4);
|
||||
if (GlbHeaderSize + GlbChunkHeaderSize + json_length > size)
|
||||
if (json_length > size - GlbHeaderSize - GlbChunkHeaderSize)
|
||||
{
|
||||
return cgltf_result_data_too_short;
|
||||
}
|
||||
@@ -1164,7 +1164,7 @@ cgltf_result cgltf_parse(const cgltf_options* options, const void* data, cgltf_s
|
||||
const void* bin = NULL;
|
||||
cgltf_size bin_size = 0;
|
||||
|
||||
if (GlbHeaderSize + GlbChunkHeaderSize + json_length + GlbChunkHeaderSize <= size)
|
||||
if (GlbChunkHeaderSize <= size - GlbHeaderSize - GlbChunkHeaderSize - json_length)
|
||||
{
|
||||
// We can read another chunk
|
||||
const uint8_t* bin_chunk = json_chunk + json_length;
|
||||
@@ -1172,7 +1172,7 @@ cgltf_result cgltf_parse(const cgltf_options* options, const void* data, cgltf_s
|
||||
// Bin chunk: length
|
||||
uint32_t bin_length;
|
||||
memcpy(&bin_length, bin_chunk, 4);
|
||||
if (GlbHeaderSize + GlbChunkHeaderSize + json_length + GlbChunkHeaderSize + bin_length > size)
|
||||
if (bin_length > size - GlbHeaderSize - GlbChunkHeaderSize - json_length - GlbChunkHeaderSize)
|
||||
{
|
||||
return cgltf_result_data_too_short;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user