summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-12-24 15:37:24 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-12-24 15:37:24 +0000
commitebafc1c2d39eb61c53503a7de1195aa97d77f9a9 (patch)
treeb8baf5643b63151bbecb092d7637c9db4cdd4233 /regress
parent247a5c763d36a898360d28b86187cff9fc62a121 (diff)
Prevent unsigned integer underflow when a number is too wide
for a table cell with an "nz" layout specification, causing essentially infinite output as found by jsg@ with afl.
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.bin/mandoc/tbl/Makefile16
-rw-r--r--regress/usr.bin/mandoc/tbl/misalign.in16
-rw-r--r--regress/usr.bin/mandoc/tbl/misalign.out_ascii22
3 files changed, 51 insertions, 3 deletions
diff --git a/regress/usr.bin/mandoc/tbl/Makefile b/regress/usr.bin/mandoc/tbl/Makefile
index 95f1bb4f971..4213a0626ed 100644
--- a/regress/usr.bin/mandoc/tbl/Makefile
+++ b/regress/usr.bin/mandoc/tbl/Makefile
@@ -1,8 +1,18 @@
-# $OpenBSD: Makefile,v 1.5 2014/12/16 23:44:16 schwarze Exp $
+# $OpenBSD: Makefile,v 1.6 2014/12/24 15:37:23 schwarze Exp $
-REGRESS_TARGETS = center fonts macro nested numbers span vert
+REGRESS_TARGETS = center fonts macro misalign nested numbers span vert
LINT_TARGETS = macro nested
-SKIP_GROFF = nested
+
+# groff-1.22.3 defect:
+# - When space is insufficient (on either side) for properly aligning
+# a number, GNU tbl(1) moves the number too much to the right,
+# overflowing the column, even if space would be sufficient without
+# left padding.
+
+# trivial difference to groff-1.22.3:
+# .TS in a table causes a blank table line in GNU tbl(1), but not in mandoc.
+
+SKIP_GROFF = misalign nested
SKIP_TMAN ?= ALL
TBL = /usr/local/bin/tbl
diff --git a/regress/usr.bin/mandoc/tbl/misalign.in b/regress/usr.bin/mandoc/tbl/misalign.in
new file mode 100644
index 00000000000..d7d3226240b
--- /dev/null
+++ b/regress/usr.bin/mandoc/tbl/misalign.in
@@ -0,0 +1,16 @@
+.TH TBL-MISALIGN 1 "December 24, 2014" OpenBSD
+.SH NAME
+tbl-misalign \- failing alignment in tables
+.SH DESCRIPTION
+normal text
+.TS
+box tab(:);
+n, nz.
+12.34
+_
+100.0
+0.001
+_
+1000.0
+0.0001
+.TE
diff --git a/regress/usr.bin/mandoc/tbl/misalign.out_ascii b/regress/usr.bin/mandoc/tbl/misalign.out_ascii
new file mode 100644
index 00000000000..324ee7e518c
--- /dev/null
+++ b/regress/usr.bin/mandoc/tbl/misalign.out_ascii
@@ -0,0 +1,22 @@
+TBL-MISALIGN(1) General Commands Manual TBL-MISALIGN(1)
+
+
+
+NNAAMMEE
+ tbl-misalign - failing alignment in tables
+
+DDEESSCCRRIIPPTTIIOONN
+ normal text
+
+ +------+
+ |12.34 |
+ +------+
+ |100.0 |
+ |0.001 |
+ +------+
+ |1000.0 |
+ |0.0001 |
+ +------+
+
+
+OpenBSD December 24, 2014 TBL-MISALIGN(1)