summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2010-12-09 23:01:19 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2010-12-09 23:01:19 +0000
commitf1e79ec68713661173a39689ac7ec54384c9e6eb (patch)
treebabcca5dc5a7aa2a2a3fb31ebf9a38d0edbc4f83 /regress
parentfbbf922c8d34a7f92addc03a7578776c5853b61c (diff)
Abort endless loops during roff macro and string expansion.
For now, use the simplest conceivable approach, like groff does: Just a fixed, ugly input stack limit. Kristaps@ agrees.
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.bin/mandoc/roff/string/Makefile4
-rw-r--r--regress/usr.bin/mandoc/roff/string/infinite.in8
-rw-r--r--regress/usr.bin/mandoc/roff/string/infinite.out_ascii12
3 files changed, 22 insertions, 2 deletions
diff --git a/regress/usr.bin/mandoc/roff/string/Makefile b/regress/usr.bin/mandoc/roff/string/Makefile
index 38c6c1f5afc..5577da4097e 100644
--- a/regress/usr.bin/mandoc/roff/string/Makefile
+++ b/regress/usr.bin/mandoc/roff/string/Makefile
@@ -1,5 +1,5 @@
-# $OpenBSD: Makefile,v 1.1 2010/12/09 20:56:30 schwarze Exp $
+# $OpenBSD: Makefile,v 1.2 2010/12/09 23:01:18 schwarze Exp $
-REGRESS_TARGETS=escape
+REGRESS_TARGETS=escape infinite
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/roff/string/infinite.in b/regress/usr.bin/mandoc/roff/string/infinite.in
new file mode 100644
index 00000000000..6c25f7ca7af
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/string/infinite.in
@@ -0,0 +1,8 @@
+.TH STRING-INFINITE 1 "December 3, 2010"
+.SH NAME
+string-infinite - endless recursion in string expansion
+.SH DESCRIPTION
+.ds recur \\*[recur]
+Blow up,
+(and do not \*[recur] print this)
+but still render following text correctly.
diff --git a/regress/usr.bin/mandoc/roff/string/infinite.out_ascii b/regress/usr.bin/mandoc/roff/string/infinite.out_ascii
new file mode 100644
index 00000000000..0e1bee3680f
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/string/infinite.out_ascii
@@ -0,0 +1,12 @@
+STRING-INFINITE(1) STRING-INFINITE(1)
+
+
+
+NNAAMMEE
+ string-infinite - endless recursion in string expansion
+
+DDEESSCCRRIIPPTTIIOONN
+ Blow up, but still render following text correctly.
+
+
+