scdoc2mdoc

A fork of scdoc to output mdoc(7)
git clone git://git.sgregoratto.me/scdoc2mdoc
Log | Files | Refs | README | LICENSE

commit 0d731c6aa0966ad15cb7e2c6158df5bff07c9f41
parent a98e24ac700670069e905578f8260a4e3aed6373
Author: Brian Ashworth <bosrsf04@gmail.com>
Date:   Thu, 28 Feb 2019 12:16:56 -0500

parse_text: return if next is UTF8_INVALID

In the underscore case, the next character is retrieved to check
whether the underscore is at a word break. However, if this character
is UTF8_INVALID, the call to parser_pushch will be a noop. This
results in the loop continuing on further than it should. This just
adds a check to see if next is UTF8_INVALID and returns if it is.

Signed-off-by: Brian Ashworth <bosrsf04@gmail.com>

Diffstat:
Msrc/main.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/main.c b/src/main.c @@ -219,6 +219,9 @@ static void parse_text(struct parser *p) { } else { utf8_fputch(p->output, ch); } + if (next == UTF8_INVALID) { + return; + } parser_pushch(p, next); break; case '+':