]> git.cameronkatri.com Git - mandoc.git/commitdiff
When looking for the next block to tag, we aren't interested in children
authorIngo Schwarze <schwarze@openbsd.org>
Wed, 8 Jun 2022 16:31:46 +0000 (16:31 +0000)
committerIngo Schwarze <schwarze@openbsd.org>
Wed, 8 Jun 2022 16:31:46 +0000 (16:31 +0000)
of the current block but really want the next block instead.  This fixes
a segfault reported by Evan Silberman <evan at jklol dot net> on bugs@.

mdoc_validate.c

index a92d407773dd2166c73a2aeb01303c32c0aae6f2..c4c8aecfa71e1379a622301bec3c3cb33e222ac0 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.390 2021/10/04 14:19:14 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.391 2022/06/08 16:31:46 schwarze Exp $ */
 /*
  * Copyright (c) 2010-2021 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -1113,7 +1113,8 @@ post_tg(POST_ARGS)
        /* Find the next node. */
        n = mdoc->last;
        for (nn = n; nn != NULL; nn = nn->parent) {
-               if (nn->next != NULL) {
+               if (nn->type != ROFFT_HEAD && nn->type != ROFFT_BODY &&
+                   nn->type != ROFFT_TAIL && nn->next != NULL) {
                        nn = nn->next;
                        break;
                }