Fix potential heapbuffer overflow in md5 parsing

pull/5652/head
Matthias Möller 2024-07-03 22:44:03 +02:00
parent ddb74c2bbd
commit 012c44d556
1 changed files with 6 additions and 0 deletions

View File

@ -234,8 +234,12 @@ inline void AI_MD5_READ_TRIPLE(aiVector3D &vec, const char **sz, const char *buf
AI_MD5_SKIP_SPACES(sz, bufferEnd, linenumber);
if ('(' != **sz) {
MD5Parser::ReportWarning("Unexpected token: ( was expected", linenumber);
if (*sz == bufferEnd)
return;
++*sz;
}
if (*sz == bufferEnd)
return;
++*sz;
AI_MD5_SKIP_SPACES(sz, bufferEnd, linenumber);
*sz = fast_atoreal_move<float>(*sz, (float &)vec.x);
@ -247,6 +251,8 @@ inline void AI_MD5_READ_TRIPLE(aiVector3D &vec, const char **sz, const char *buf
if (')' != **sz) {
MD5Parser::ReportWarning("Unexpected token: ) was expected", linenumber);
}
if (*sz == bufferEnd)
return;
++*sz;
}