diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-11-21 01:52:46 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-11-21 01:52:46 +0000 |
commit | f9c5aa7d69d88925112dd90b779add4bc63ba3df (patch) | |
tree | a5920212e1a96269a7d30be129b4bff01199a9bd /regress/usr.bin/mandoc/mdoc/Dd | |
parent | 422a96a9ad6a4ffd61a706d7847f96526bfdcdd3 (diff) |
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.
Diffstat (limited to 'regress/usr.bin/mandoc/mdoc/Dd')
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Dd/Makefile | 8 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Dd/long.in | 8 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Dd/long.out_ascii | 11 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/mdoc/Dd/long.out_lint | 1 |
4 files changed, 24 insertions, 4 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/Dd/Makefile b/regress/usr.bin/mandoc/mdoc/Dd/Makefile index d1c890d1bdb..e50e9b6101f 100644 --- a/regress/usr.bin/mandoc/mdoc/Dd/Makefile +++ b/regress/usr.bin/mandoc/mdoc/Dd/Makefile @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile,v 1.1 2014/08/14 02:00:52 schwarze Exp $ +# $OpenBSD: Makefile,v 1.2 2014/11/21 01:52:45 schwarze Exp $ -REGRESS_TARGETS = badarg dupe late manarg noarg order -LINT_TARGETS = badarg dupe late manarg noarg order +REGRESS_TARGETS = badarg dupe late long manarg noarg order +LINT_TARGETS = badarg dupe late long manarg noarg order # If groff finds exactly three arguments, it assumes they are month, # day and year without further checking. If there are no arguments, @@ -9,7 +9,7 @@ LINT_TARGETS = badarg dupe late manarg noarg order # to today's date. # That is not at all sane behaviour, we are not going to imitate it. -SKIP_GROFF = badarg manarg noarg +SKIP_GROFF = badarg long manarg noarg SKIP_ASCII = noarg # Autodetection fails for late .Dd, so specify -mdoc explicitly. diff --git a/regress/usr.bin/mandoc/mdoc/Dd/long.in b/regress/usr.bin/mandoc/mdoc/Dd/long.in new file mode 100644 index 00000000000..2538f984feb --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Dd/long.in @@ -0,0 +1,8 @@ +.Dd 1234567890123456789012345678901234567890123456789012345678901234567890123456789 +.Dt DD-LONG 1 +.Os OpenBSD +.Sh NAME +.Nm Dd-long +.Nd long date string +.Sh DESCRIPTION +some text diff --git a/regress/usr.bin/mandoc/mdoc/Dd/long.out_ascii b/regress/usr.bin/mandoc/mdoc/Dd/long.out_ascii new file mode 100644 index 00000000000..69811af2771 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Dd/long.out_ascii @@ -0,0 +1,11 @@ +DD-LONG(1) General Commands Manual DD-LONG(1) + +NNAAMMEE + DDdd--lloonngg - long date string + +DDEESSCCRRIIPPTTIIOONN + some text + +OpenBSD +1234567890123456789012345678901234567890123456789012345678901234567890123456789 + OpenBSD diff --git a/regress/usr.bin/mandoc/mdoc/Dd/long.out_lint b/regress/usr.bin/mandoc/mdoc/Dd/long.out_lint new file mode 100644 index 00000000000..d74ed9e2b95 --- /dev/null +++ b/regress/usr.bin/mandoc/mdoc/Dd/long.out_lint @@ -0,0 +1 @@ +mandoc: long.in:1:2: WARNING: cannot parse date, using it verbatim: 1234567890123456789012345678901234567890123456789012345678901234567890123456789 |