From 7b5064fd104ca084d6c1a9408571ee5e04a98390 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 27 Apr 2022 17:04:16 +0000 Subject: The .AT, .DT, and .UC macros are allowed inside next-line scope and never produce output at the place of their invocation. Minibugs found while investigating unrelated afl(1) reports from tb@. --- regress/usr.bin/mandoc/man/AT/Makefile | 5 +++++ regress/usr.bin/mandoc/man/AT/basic.in | 10 ++++++++++ regress/usr.bin/mandoc/man/AT/basic.out_ascii | 9 +++++++++ regress/usr.bin/mandoc/man/DT/Makefile | 5 +++++ regress/usr.bin/mandoc/man/DT/basic.in | 22 ++++++++++++++++++++++ regress/usr.bin/mandoc/man/DT/basic.out_ascii | 21 +++++++++++++++++++++ regress/usr.bin/mandoc/man/Makefile | 4 ++-- regress/usr.bin/mandoc/man/UC/Makefile | 5 +++++ regress/usr.bin/mandoc/man/UC/basic.in | 10 ++++++++++ regress/usr.bin/mandoc/man/UC/basic.out_ascii | 9 +++++++++ usr.bin/mandoc/man_macro.c | 8 ++++---- usr.bin/mandoc/man_term.c | 8 ++++---- 12 files changed, 106 insertions(+), 10 deletions(-) create mode 100644 regress/usr.bin/mandoc/man/AT/Makefile create mode 100644 regress/usr.bin/mandoc/man/AT/basic.in create mode 100644 regress/usr.bin/mandoc/man/AT/basic.out_ascii create mode 100644 regress/usr.bin/mandoc/man/DT/Makefile create mode 100644 regress/usr.bin/mandoc/man/DT/basic.in create mode 100644 regress/usr.bin/mandoc/man/DT/basic.out_ascii create mode 100644 regress/usr.bin/mandoc/man/UC/Makefile create mode 100644 regress/usr.bin/mandoc/man/UC/basic.in create mode 100644 regress/usr.bin/mandoc/man/UC/basic.out_ascii diff --git a/regress/usr.bin/mandoc/man/AT/Makefile b/regress/usr.bin/mandoc/man/AT/Makefile new file mode 100644 index 00000000000..44cf05195ce --- /dev/null +++ b/regress/usr.bin/mandoc/man/AT/Makefile @@ -0,0 +1,5 @@ +# $OpenBSD: Makefile,v 1.1 2022/04/27 17:04:15 schwarze Exp $ + +REGRESS_TARGETS = basic + +.include diff --git a/regress/usr.bin/mandoc/man/AT/basic.in b/regress/usr.bin/mandoc/man/AT/basic.in new file mode 100644 index 00000000000..35eb2375a17 --- /dev/null +++ b/regress/usr.bin/mandoc/man/AT/basic.in @@ -0,0 +1,10 @@ +.\" $OpenBSD: basic.in,v 1.1 2022/04/27 17:04:15 schwarze Exp $ +.TH AT-BASIC 1 "April 27, 2022" +.SH NAME +AT-basic \- the AT&T footer macro +.SH DESCRIPTION +initial text +.B +.AT +bold text +final text diff --git a/regress/usr.bin/mandoc/man/AT/basic.out_ascii b/regress/usr.bin/mandoc/man/AT/basic.out_ascii new file mode 100644 index 00000000000..962c9f8852c --- /dev/null +++ b/regress/usr.bin/mandoc/man/AT/basic.out_ascii @@ -0,0 +1,9 @@ +AT-BASIC(1) General Commands Manual AT-BASIC(1) + +NNAAMMEE + AT-basic - the AT&T footer macro + +DDEESSCCRRIIPPTTIIOONN + initial text bboolldd tteexxtt final text + +7th Edition April 27, 2022 AT-BASIC(1) diff --git a/regress/usr.bin/mandoc/man/DT/Makefile b/regress/usr.bin/mandoc/man/DT/Makefile new file mode 100644 index 00000000000..44cf05195ce --- /dev/null +++ b/regress/usr.bin/mandoc/man/DT/Makefile @@ -0,0 +1,5 @@ +# $OpenBSD: Makefile,v 1.1 2022/04/27 17:04:15 schwarze Exp $ + +REGRESS_TARGETS = basic + +.include diff --git a/regress/usr.bin/mandoc/man/DT/basic.in b/regress/usr.bin/mandoc/man/DT/basic.in new file mode 100644 index 00000000000..8902e59453c --- /dev/null +++ b/regress/usr.bin/mandoc/man/DT/basic.in @@ -0,0 +1,22 @@ +.\" $OpenBSD: basic.in,v 1.1 2022/04/27 17:04:15 schwarze Exp $ +.TH DT-BASIC 1 "April 27, 2022" +.SH NAME +DT-basic \- restore the default tabulator positions +.SH DESCRIPTION +.nf +Default tabs are every five columns: +1234 1234 1234 1234 1234 +one two three four +.PP +Custom tabs: column 6, then every 8 columns: +12345 1234567 1234567 1234567 +.ta 6n T 8n +one two three four +.PP +.B +.DT +bold text +.PP +Back to the default: +1234 1234 1234 1234 1234 +one two three four diff --git a/regress/usr.bin/mandoc/man/DT/basic.out_ascii b/regress/usr.bin/mandoc/man/DT/basic.out_ascii new file mode 100644 index 00000000000..8ccbc685c20 --- /dev/null +++ b/regress/usr.bin/mandoc/man/DT/basic.out_ascii @@ -0,0 +1,21 @@ +DT-BASIC(1) General Commands Manual DT-BASIC(1) + +NNAAMMEE + DT-basic - restore the default tabulator positions + +DDEESSCCRRIIPPTTIIOONN + Default tabs are every five columns: + 1234 1234 1234 1234 1234 + one two three four + + Custom tabs: column 6, then every 8 columns: + 12345 1234567 1234567 1234567 + one two three four + + bboolldd tteexxtt + + Back to the default: + 1234 1234 1234 1234 1234 + one two three four + +OpenBSD April 27, 2022 DT-BASIC(1) diff --git a/regress/usr.bin/mandoc/man/Makefile b/regress/usr.bin/mandoc/man/Makefile index 23d6e04b3f3..17a939b2243 100644 --- a/regress/usr.bin/mandoc/man/Makefile +++ b/regress/usr.bin/mandoc/man/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.19 2019/01/05 21:13:55 schwarze Exp $ +# $OpenBSD: Makefile,v 1.20 2022/04/27 17:04:15 schwarze Exp $ -SUBDIR = B BI EX HP IP MT OP PD PP RS SH SS SY TH TP TS UR nf blank +SUBDIR = AT B BI DT EX HP IP MT OP PD PP RS SH SS SY TH TP TS UC UR nf blank .include "../Makefile.sub" .include diff --git a/regress/usr.bin/mandoc/man/UC/Makefile b/regress/usr.bin/mandoc/man/UC/Makefile new file mode 100644 index 00000000000..44cf05195ce --- /dev/null +++ b/regress/usr.bin/mandoc/man/UC/Makefile @@ -0,0 +1,5 @@ +# $OpenBSD: Makefile,v 1.1 2022/04/27 17:04:15 schwarze Exp $ + +REGRESS_TARGETS = basic + +.include diff --git a/regress/usr.bin/mandoc/man/UC/basic.in b/regress/usr.bin/mandoc/man/UC/basic.in new file mode 100644 index 00000000000..f6f71be0521 --- /dev/null +++ b/regress/usr.bin/mandoc/man/UC/basic.in @@ -0,0 +1,10 @@ +.\" $OpenBSD: basic.in,v 1.1 2022/04/27 17:04:15 schwarze Exp $ +.TH UC-BASIC 1 "April 27, 2022" +.SH NAME +UC-basic \- the University of California footer macro +.SH DESCRIPTION +initial text +.B +.UC +bold text +final text diff --git a/regress/usr.bin/mandoc/man/UC/basic.out_ascii b/regress/usr.bin/mandoc/man/UC/basic.out_ascii new file mode 100644 index 00000000000..fa29e19d396 --- /dev/null +++ b/regress/usr.bin/mandoc/man/UC/basic.out_ascii @@ -0,0 +1,9 @@ +UC-BASIC(1) General Commands Manual UC-BASIC(1) + +NNAAMMEE + UC-basic - the University of California footer macro + +DDEESSCCRRIIPPTTIIOONN + initial text bboolldd tteexxtt final text + +3rd Berkeley Distribution April 27, 2022 UC-BASIC(1) diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c index 779b28278fe..10f07763f7f 100644 --- a/usr.bin/mandoc/man_macro.c +++ b/usr.bin/mandoc/man_macro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_macro.c,v 1.108 2022/04/13 14:37:34 schwarze Exp $ */ +/* $OpenBSD: man_macro.c,v 1.109 2022/04/27 17:04:15 schwarze Exp $ */ /* * Copyright (c) 2012-2015,2017-2020,2022 Ingo Schwarze * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons @@ -63,10 +63,10 @@ static const struct man_macro man_macros[MAN_MAX - MAN_TH] = { { in_line_eoln, 0 }, /* RI */ { blk_close, MAN_XSCOPE }, /* RE */ { blk_exp, MAN_XSCOPE }, /* RS */ - { in_line_eoln, 0 }, /* DT */ - { in_line_eoln, 0 }, /* UC */ + { in_line_eoln, MAN_NSCOPED }, /* DT */ + { in_line_eoln, MAN_NSCOPED }, /* UC */ { in_line_eoln, MAN_NSCOPED }, /* PD */ - { in_line_eoln, 0 }, /* AT */ + { in_line_eoln, MAN_NSCOPED }, /* AT */ { in_line_eoln, MAN_NSCOPED }, /* in */ { blk_imp, MAN_XSCOPE }, /* SY */ { blk_close, MAN_XSCOPE }, /* YS */ diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index 375555025e0..2152cdea691 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,6 +1,6 @@ -/* $OpenBSD: man_term.c,v 1.189 2021/06/28 19:49:57 schwarze Exp $ */ +/* $OpenBSD: man_term.c,v 1.190 2022/04/27 17:04:15 schwarze Exp $ */ /* - * Copyright (c) 2010-2015, 2017-2020 Ingo Schwarze + * Copyright (c) 2010-2015,2017-2020,2022 Ingo Schwarze * Copyright (c) 2008-2012 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any @@ -119,10 +119,10 @@ static const struct man_term_act man_term_acts[MAN_MAX - MAN_TH] = { { pre_alternate, NULL, 0 }, /* RI */ { NULL, NULL, 0 }, /* RE */ { pre_RS, post_RS, 0 }, /* RS */ - { pre_DT, NULL, 0 }, /* DT */ + { pre_DT, NULL, MAN_NOTEXT }, /* DT */ { pre_ign, NULL, MAN_NOTEXT }, /* UC */ { pre_PD, NULL, MAN_NOTEXT }, /* PD */ - { pre_ign, NULL, 0 }, /* AT */ + { pre_ign, NULL, MAN_NOTEXT }, /* AT */ { pre_in, NULL, MAN_NOTEXT }, /* in */ { pre_SY, post_SY, 0 }, /* SY */ { NULL, NULL, 0 }, /* YS */ -- cgit v1.2.3