Skip to content

Commit

Permalink
Fix Heap-buffer-overflow READ in Assimp::MD5::MD5MeshParser::MD5MeshP…
Browse files Browse the repository at this point in the history
…arser
  • Loading branch information
sashashura committed Jun 3, 2023
1 parent d9a8837 commit 5cc4a61
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions code/AssetLib/MD5/MD5Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,20 @@ bool MD5Parser::ParseSection(Section &out) {
out.data[out.length] = '\0';

// parse a string, enclosed in quotation marks
#define AI_MD5_PARSE_STRING_IN_QUOTATION(out) \
while ('\"' != *sz) \
++sz; \
const char *szStart = ++sz; \
while ('\"' != *sz) \
++sz; \
const char *szEnd = (sz++); \
out.length = (ai_uint32)(szEnd - szStart); \
::memcpy(out.data, szStart, out.length); \
#define AI_MD5_PARSE_STRING_IN_QUOTATION(out) \
out.length = 0; \
while ('\"' != *sz && '\0' != *sz) \
++sz; \
if ('\0' != *sz) { \
const char *szStart = ++sz; \
while ('\"' != *sz && '\0' != *sz) \
++sz; \
if ('\0' != *sz) { \
const char *szEnd = (sz++); \
out.length = (ai_uint32)(szEnd - szStart); \
::memcpy(out.data, szStart, out.length); \
} \
} \
out.data[out.length] = '\0';
// ------------------------------------------------------------------------------------------------
// .MD5MESH parsing function
Expand Down

0 comments on commit 5cc4a61

Please sign in to comment.