summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@netbsd.org>2011-11-18 14:58:24 +0000
committerJoerg Sonnenberger <joerg@netbsd.org>2011-11-18 14:58:24 +0000
commit1d7f84eca0e8c3268605b44ee06179bea600c94f (patch)
tree9737af2c1cc0863eedd5c86e931f65c2c52d0e1d
parentc6a92b0f2edb58bd80173e5a0e1039832bf104fd (diff)
downloadmandoc-1d7f84eca0e8c3268605b44ee06179bea600c94f.tar.gz
Bail out explicitly on invalid .Rs content like:
.Rs plain text .Re This avoids a crash on invalid.
-rw-r--r--mdoc_validate.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 09f91873..efa769d2 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1693,6 +1693,10 @@ post_rs(POST_ARGS)
mdoc_node_delete(mdoc, nn);
}
+ /* Bail out early if a plain text node is found inside .Rs. */
+ if (NULL == mdoc->last->child)
+ return(1);
+
/*
* The full `Rs' block needs special handling to order the
* sub-elements according to `rsord'. Pick through each element