summaryrefslogtreecommitdiffstats
path: root/regress/roff/de/infinite.in
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-03-07 20:00:08 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-03-07 20:00:08 +0000
commit0048f6b4d138a5084ab0895e54f81bfa74d70f76 (patch)
treeec3e7d582b64f0f9f1ef6029f20f4a4a52806f1a /regress/roff/de/infinite.in
parent26f4474f228f82cd5061c568f57cb6fec975c194 (diff)
downloadmandoc-0048f6b4d138a5084ab0895e54f81bfa74d70f76.tar.gz
If a user-defined macro is aborted because it exceeds the stack
limit, usually due to infinite recursion, discard whatever remains in all those open stack levels. Otherwise, insane constructions like the following could generate macros of enormous size, causing mandoc(1) to die from memory exhaustion: .de m \" original macro definition .m \" recursion to blow up the stack .de m \" definition to be run during the call of .m marked (*) very long plain text (some kilobytes) .m \" expand the above a thousand times while unwinding the stack .. \" end of the original definition .m \" (*) recursively generate a ridiculously large macro .. \" end of recursively generated definition .m \" execute the giant macro, exhausting memory Very creative abuse found by tb@ with afl(1).
Diffstat (limited to 'regress/roff/de/infinite.in')
-rw-r--r--regress/roff/de/infinite.in14
1 files changed, 14 insertions, 0 deletions
diff --git a/regress/roff/de/infinite.in b/regress/roff/de/infinite.in
new file mode 100644
index 00000000..683eba7f
--- /dev/null
+++ b/regress/roff/de/infinite.in
@@ -0,0 +1,14 @@
+.Dd March 7, 2017
+.Dt DE-INFINITE 1
+.Os OpenBSD
+.Sh NAME
+.Nm de-infinite
+.Nd inifinte recursion in a user-defined macro
+.Sh DESCRIPTION
+initial text
+.de mym
+.mym
+not printed
+..
+.mym
+final text