CVSROOT:        /cvs
Module name:    src
Changes by:     schwa...@cvs.openbsd.org        2014/11/20 18:52:45

Modified files:
        usr.bin/mandoc : man_term.c mdoc_term.c term.c 
        regress/usr.bin/mandoc/man/HP: spacing.in spacing.out_ascii 
        regress/usr.bin/mandoc/man/TH: Makefile 
        regress/usr.bin/mandoc/mdoc/Bd: offset-empty.in 
                                        offset-empty.out_ascii 
        regress/usr.bin/mandoc/mdoc/Bl: offset.in offset.out_ascii 
        regress/usr.bin/mandoc/mdoc/Dd: Makefile 
        regress/usr.bin/mandoc/mdoc/Os: Makefile 
        regress/usr.bin/mandoc/roff/scale: horiz.in horiz.out_ascii 
Added files:
        regress/usr.bin/mandoc/man/TH: longdate.in longdate.out_ascii 
                                       longdate.out_lint longtit.in 
                                       longtit.out_ascii longvol.in 
                                       longvol.out_ascii 
        regress/usr.bin/mandoc/mdoc/Dd: long.in long.out_ascii 
                                        long.out_lint 
        regress/usr.bin/mandoc/mdoc/Os: long.in long.out_ascii 

Log message:
We repeatedly observed assertion crashes in the low-level terminal
output handler because the high level terminal formatters could be
tricked into setting the left margin further to the right than the
right margin.  Today, jsg@ found more of these with afl.

Change the internal interface between both levels, aiming for
simplicity and robustness of the code.  Treat both margins as
*independent* settings:  Now, termp.offset is the requested left
margin, and termp.rmargin is the available space.  Let the lower
level cope with that case of insufficient space.

Obviously, high level code that does centering or flush right
still has to do careful checks, so i did a full audit of margin
settings in the terminal formatters.

Fixes crashes caused by excessively long title or date strings in
the man(7) footer, operating system or date strings in the mdoc(7)
footer, volume strings in the man(7) or mdoc(7) header, and a few
cases related to some non-prologue macros.

Reply via email to