Merge pull request #4050 from assimp/kimkulling-fuzzer_issue_24553
Fix possible overrunpull/4051/head
commit
afd0f65ceb
|
@ -59,13 +59,16 @@ void CommentRemover::RemoveLineComments(const char* szComment,
|
||||||
ai_assert(nullptr != szBuffer);
|
ai_assert(nullptr != szBuffer);
|
||||||
ai_assert(*szComment);
|
ai_assert(*szComment);
|
||||||
|
|
||||||
const size_t len = strlen(szComment);
|
size_t len = strlen(szComment);
|
||||||
|
const size_t lenBuffer = strlen(szBuffer);
|
||||||
|
if (len > lenBuffer) {
|
||||||
|
len = lenBuffer;
|
||||||
|
}
|
||||||
while (*szBuffer) {
|
while (*szBuffer) {
|
||||||
|
|
||||||
// skip over quotes
|
// skip over quotes
|
||||||
if (*szBuffer == '\"' || *szBuffer == '\'')
|
if (*szBuffer == '\"' || *szBuffer == '\'')
|
||||||
while (*szBuffer++ && *szBuffer != '\"' && *szBuffer != '\'');
|
while (*szBuffer++ && *szBuffer != '\"' && *szBuffer != '\'');
|
||||||
|
|
||||||
if (!strncmp(szBuffer,szComment,len)) {
|
if (!strncmp(szBuffer,szComment,len)) {
|
||||||
while (!IsLineEnd(*szBuffer))
|
while (!IsLineEnd(*szBuffer))
|
||||||
*szBuffer++ = chReplacement;
|
*szBuffer++ = chReplacement;
|
||||||
|
|
Loading…
Reference in New Issue