Skip to content

Commit

Permalink
Merge pull request #167 from dtldarek/master
Browse files Browse the repository at this point in the history
Two buffer overflow fixes.
  • Loading branch information
mity authored Jan 6, 2022
2 parents a8bb4d3 + b8c31a5 commit eeb32ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ Changes:

Fixes:

* [#167](https://github.com/mity/md4c/issues/167):
Fix two buffer overflow bugs found using a fuzz testting. Contributed by
dtldarek.

* [#163](https://github.com/mity/md4c/issues/163):
Make HTML renderer to emit `'\n'` after the root tag when in the XHTML mode.

Expand Down
3 changes: 2 additions & 1 deletion src/md4c.c
Original file line number Diff line number Diff line change
Expand Up @@ -2275,7 +2275,7 @@ md_is_inline_link_spec(MD_CTX* ctx, const MD_LINE* lines, int n_lines,
/* Optional white space with up to one line break. */
while(off < lines[line_index].end && ISWHITESPACE(off))
off++;
if(off >= lines[line_index].end && ISNEWLINE(off)) {
if(off >= lines[line_index].end && (off >= ctx->size || ISNEWLINE(off))) {
line_index++;
if(line_index >= n_lines)
return FALSE;
Expand Down Expand Up @@ -5683,6 +5683,7 @@ md_is_container_mark(MD_CTX* ctx, unsigned indent, OFF beg, OFF* p_end, MD_CONTA
off++;
}
if(off > beg &&
off < ctx->size &&
(CH(off) == _T('.') || CH(off) == _T(')')) &&
(off+1 >= ctx->size || ISBLANK(off+1) || ISNEWLINE(off+1)))
{
Expand Down

0 comments on commit eeb32ec

Please sign in to comment.