CVSROOT:        /cvs
Module name:    src
Changes by:     [email protected]        2026/08/29 10:57:20

Modified files:
        usr.bin/mandoc : roff_escape.c 

Log message:
Fix a segfault that bluhm@ found on his i386 regress machine.

Even in the "out:" code path of the escape sequence parser,
for rval == ESCAPE_SPECIAL, some of the parsing results are
still used for error reporting purposes, specifically to
distinguish valid and invalid character names.

So, when parsing fails so badly that there is no name whatsoever,
it is not sufficient to bail out via "goto out;" but in addition,
we must make sure that the return value does not remain ESCAPE_SPECIAL.

However, other return values must remain intact even in case of
extremely bad parsing errors.  For example, an \A escape sequence
still qualifies as an ESCAPE_EXPAND sequence and must expand
to the string "0" even if it lacks any argument whatsoever.

Reply via email to