cmark

My personal build of CMark ✏️

Commit
a804ce024b8fdc849b59a74826e6aa4774f7ddd1
Parent
67ad9d17dfbe26e3ac526715d283e2667f28998c
Author
John MacFarlane <jgm@berkeley.edu>
Date

Fixed off-by-one error in line splitting routine.

This caused certain NULLs not to be replaced.

Found my 'make fuzztest'.

Diffstat

1 file changed, 1 insertion, 2 deletions

Status File Name N° Changes Insertions Deletions
Modified src/blocks.c 3 1 2
diff --git a/src/blocks.c b/src/blocks.c
@@ -506,7 +506,6 @@ S_parser_feed(cmark_parser *parser, const unsigned char *buffer, size_t len,
 		const unsigned char *eol;
 		bufsize_t chunk_len;
 		bool process = false;
-
 		for (eol = buffer; eol < end; ++eol) {
 			if (S_is_line_end_char(*eol)) {
 				if (eol < end && *eol == '\r')
@@ -516,7 +515,7 @@ S_parser_feed(cmark_parser *parser, const unsigned char *buffer, size_t len,
 				process = true;
 				break;
 			}
-			if (*eol == '\0' && eol < end - 1) {
+			if (*eol == '\0' && eol < end) {
 				break;
 			}
 		}