diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commonmark.c | 3 | ||||
-rw-r--r-- | src/man.c | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/commonmark.c b/src/commonmark.c index bef92f6..24ee8ce 100644 --- a/src/commonmark.c +++ b/src/commonmark.c @@ -117,6 +117,9 @@ static inline void out(struct render_state *state, } len = utf8proc_iterate(source + i, length - i, &c); + if (len == -1) { // error condition + return; // return without rendering rest of string + } nextc = source[i + len]; if (c == 32 && wrap) { if (!state->begin_line) { @@ -20,6 +20,9 @@ static void escape_man(cmark_strbuf *dest, const unsigned char *source, int leng while (i < length) { len = utf8proc_iterate(source + i, length - i, &c); + if (len == -1) { // error condition + return; // return without rendering anything + } switch(c) { case 46: if (beginLine) { |