- Commit
- 87d66880803c9362f135d894652f6d0ed50b73bc
- Parent
- d4047b95a4d8564ef6959a4fb63fc2e2e0708399
- Author
- John MacFarlane <jgm@berkeley.edu>
- Date
Fixed memory issue.
This fixes valgrind "invalid read of size 1" on input `[link](<>)`.
My personal build of CMark ✏️
Fixed memory issue.
This fixes valgrind "invalid read of size 1" on input `[link](<>)`.
1 file changed, 2 insertions, 2 deletions
Status | File Name | N° Changes | Insertions | Deletions |
Modified | src/inlines.c | 4 | 2 | 2 |
diff --git a/src/inlines.c b/src/inlines.c @@ -636,7 +636,7 @@ unsigned char *cmark_clean_url(cmark_chunk *url) } cmark_strbuf_unescape(&buf); - return cmark_strbuf_detach(&buf); + return buf.size == 0 ? NULL : cmark_strbuf_detach(&buf); } unsigned char *cmark_clean_title(cmark_chunk *title) @@ -660,7 +660,7 @@ unsigned char *cmark_clean_title(cmark_chunk *title) } cmark_strbuf_unescape(&buf); - return cmark_strbuf_detach(&buf); + return buf.size == 0 ? NULL : cmark_strbuf_detach(&buf); } // Parse an autolink or HTML tag.