Skip to content

Commit

Permalink
Merge pull request #10891 from lahwaacz/markdown-fix-overflow
Browse files Browse the repository at this point in the history
Fix buffer overflow in Markdown parser
  • Loading branch information
doxygen committed May 25, 2024
2 parents 2dccfe1 + 28b51a7 commit 8ddb6bb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/markdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,11 @@ size_t Markdown::Private::findEmphasisChar(std::string_view data, char c, size_t
data[i]!='\\' && data[i]!='@' &&
!(data[i]=='/' && data[i-1]=='<') && // html end tag also ends emphasis
data[i]!='\n') i++;
// avoid overflow (unclosed emph token)
if (i==size)
{
return 0;
}
//printf("findEmphasisChar: data=[%s] i=%d c=%c\n",data,i,data[i]);

// not counting escaped chars or characters that are unlikely
Expand Down

0 comments on commit 8ddb6bb

Please sign in to comment.