summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2015-02-03 18:19:27 +0000
committerschwarze <schwarze@openbsd.org>2015-02-03 18:19:27 +0000
commitc844d5a8ed7749ccb21439a982ce24252f0a81c2 (patch)
tree22bdbe9138171e30705c2f325452f346a2c4af07
parentmerge back a part of rev 1.15 (diff)
downloadwireguard-openbsd-c844d5a8ed7749ccb21439a982ce24252f0a81c2.tar.xz
wireguard-openbsd-c844d5a8ed7749ccb21439a982ce24252f0a81c2.zip
Avoid closing out an explicit block twice when broken by .It
(assertion failure); regression found in jsg@'s afl test case 847.
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/breakingIt.in34
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/breakingIt.out_ascii22
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/breakingIt.out_lint16
-rw-r--r--usr.bin/mandoc/mdoc_macro.c3
4 files changed, 66 insertions, 9 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/breakingIt.in b/regress/usr.bin/mandoc/mdoc/Bl/breakingIt.in
index bcae378920f..025ea257ea6 100644
--- a/regress/usr.bin/mandoc/mdoc/Bl/breakingIt.in
+++ b/regress/usr.bin/mandoc/mdoc/Bl/breakingIt.in
@@ -1,4 +1,4 @@
-.Dd December 19, 2014
+.Dd February 3, 2015
.Dt BL-BREAKINGIT 1
.Os OpenBSD
.Sh NAME
@@ -20,6 +20,22 @@ More stray text.
.It
Bullet point.
.El
+.Bl -tag -width Ds
+.It tag
+Tagged text.
+.Ao
+More tagged text.
+.It tag2
+Yet more tagged text.
+.El
+.Bl -bullet
+.It
+Item text.
+.Ao
+More item text.
+.It
+Bullet point.
+.El
.Ss Breaking full explicit macros
.Bl -tag -width Ds
Stray text.
@@ -35,3 +51,19 @@ More stray text.
.It
Bullet point.
.El
+.Bl -tag -width Ds
+.It tag
+Tagged text.
+.Bd -ragged -offset indent
+Display text.
+.It tag2
+More tagged text.
+.El
+.Bl -bullet
+.It
+Item text.
+.Bd -ragged -offset indent
+Display text.
+.It
+Bullet point.
+.El
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/breakingIt.out_ascii b/regress/usr.bin/mandoc/mdoc/Bl/breakingIt.out_ascii
index 0013bba8b6b..afb57973bb3 100644
--- a/regress/usr.bin/mandoc/mdoc/Bl/breakingIt.out_ascii
+++ b/regress/usr.bin/mandoc/mdoc/Bl/breakingIt.out_ascii
@@ -12,6 +12,14 @@ DDEESSCCRRIIPPTTIIOONN
++oo Bullet point.
+ tag Tagged text. <More tagged text.>
+
+ tag2 Yet more tagged text.
+
+ ++oo Item text. <More item text.>
+
+ ++oo Bullet point.
+
BBrreeaakkiinngg ffuullll eexxpplliicciitt mmaaccrrooss
Stray text.
@@ -24,4 +32,16 @@ DDEESSCCRRIIPPTTIIOONN
++oo Bullet point.
-OpenBSD December 19, 2014 OpenBSD
+ tag Tagged text.
+
+ Display text.
+
+ tag2 More tagged text.
+
+ ++oo Item text.
+
+ Display text.
+
+ ++oo Bullet point.
+
+OpenBSD February 3, 2015 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/breakingIt.out_lint b/regress/usr.bin/mandoc/mdoc/Bl/breakingIt.out_lint
index 50b9dcbf7c8..09048309764 100644
--- a/regress/usr.bin/mandoc/mdoc/Bl/breakingIt.out_lint
+++ b/regress/usr.bin/mandoc/mdoc/Bl/breakingIt.out_lint
@@ -4,9 +4,13 @@ mandoc: breakingIt.in:11:2: WARNING: moving content out of list: Ao
mandoc: breakingIt.in:20:2: ERROR: inserting missing end of block: It breaks Ao
mandoc: breakingIt.in:17:1: WARNING: moving content out of list: text
mandoc: breakingIt.in:18:2: WARNING: moving content out of list: Ao
-mandoc: breakingIt.in:28:2: ERROR: inserting missing end of block: It breaks Bd
-mandoc: breakingIt.in:25:1: WARNING: moving content out of list: text
-mandoc: breakingIt.in:26:2: WARNING: moving content out of list: Bd
-mandoc: breakingIt.in:35:2: ERROR: inserting missing end of block: It breaks Bd
-mandoc: breakingIt.in:32:1: WARNING: moving content out of list: text
-mandoc: breakingIt.in:33:2: WARNING: moving content out of list: Bd
+mandoc: breakingIt.in:28:2: ERROR: inserting missing end of block: It breaks Ao
+mandoc: breakingIt.in:36:2: ERROR: inserting missing end of block: It breaks Ao
+mandoc: breakingIt.in:44:2: ERROR: inserting missing end of block: It breaks Bd
+mandoc: breakingIt.in:41:1: WARNING: moving content out of list: text
+mandoc: breakingIt.in:42:2: WARNING: moving content out of list: Bd
+mandoc: breakingIt.in:51:2: ERROR: inserting missing end of block: It breaks Bd
+mandoc: breakingIt.in:48:1: WARNING: moving content out of list: text
+mandoc: breakingIt.in:49:2: WARNING: moving content out of list: Bd
+mandoc: breakingIt.in:59:2: ERROR: inserting missing end of block: It breaks Bd
+mandoc: breakingIt.in:67:2: ERROR: inserting missing end of block: It breaks Bd
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c
index 21885b10a8e..3d91845b321 100644
--- a/usr.bin/mandoc/mdoc_macro.c
+++ b/usr.bin/mandoc/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_macro.c,v 1.127 2015/02/03 01:13:48 schwarze Exp $ */
+/* $OpenBSD: mdoc_macro.c,v 1.128 2015/02/03 18:19:27 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -965,6 +965,7 @@ blk_full(MACRO_PROT_ARGS)
"It breaks %s",
mdoc_macronames[blk->tok]);
rew_pending(mdoc, blk);
+ blk = NULL;
}
/* Close out prior implicit scopes. */