]> git.cameronkatri.com Git - mandoc.git/commitdiff
Only keep leading .Sm inside a list when it immediately precedes
authorIngo Schwarze <schwarze@openbsd.org>
Thu, 18 Dec 2014 20:15:56 +0000 (20:15 +0000)
committerIngo Schwarze <schwarze@openbsd.org>
Thu, 18 Dec 2014 20:15:56 +0000 (20:15 +0000)
the first .It.  Otherwise, move it out together with whatever
follows.  Fixing an assertion failure found by jsg@ with afl.

mdoc_validate.c

index 01b2f1b7e70ef1e06f2fc4691bfc0504bbe8a615..0f5cf5c52ad0ff203605cb9631126182dfa2e267 100644 (file)
@@ -1,4 +1,4 @@
-/*     $Id: mdoc_validate.c,v 1.264 2014/12/18 19:23:41 schwarze Exp $ */
+/*     $Id: mdoc_validate.c,v 1.265 2014/12/18 20:15:56 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -1484,7 +1484,10 @@ post_bl(POST_ARGS)
 
        nchild = nbody->child;
        while (NULL != nchild) {
-               if (MDOC_It == nchild->tok || MDOC_Sm == nchild->tok) {
+               if (nchild->tok == MDOC_It ||
+                   (nchild->tok == MDOC_Sm &&
+                    nchild->next != NULL &&
+                    nchild->next->tok == MDOC_It)) {
                        nchild = nchild->next;
                        continue;
                }