Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): fix assertion failure in suffix handling



details:   https://anonhg.NetBSD.org/src/rev/42a5efb4846e
branches:  trunk
changeset: 937861:42a5efb4846e
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Aug 28 06:37:21 2020 +0000

description:
make(1): fix assertion failure in suffix handling

Found by running ./build.sh, in the very early stage.
Fixed by restoring the previous behavior of returning NULL for invalid
arguments.

diffstat:

 usr.bin/make/suff.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r aa93c1859dd2 -r 42a5efb4846e usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Fri Aug 28 06:35:50 2020 +0000
+++ b/usr.bin/make/suff.c       Fri Aug 28 06:37:21 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.125 2020/08/28 04:48:57 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.126 2020/08/28 06:37:21 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.125 2020/08/28 04:48:57 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.126 2020/08/28 06:37:21 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c     8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.125 2020/08/28 04:48:57 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.126 2020/08/28 06:37:21 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -624,8 +624,10 @@
        if (srcLn == NULL) {
            srcLn = Lst_Find(sufflist, SuffSuffIsPrefix, str);
        } else {
-           srcLn = Lst_FindFrom(sufflist, Lst_Succ(srcLn),
-                                SuffSuffIsPrefix, str);
+           LstNode succ = Lst_Succ(srcLn);
+           srcLn = succ != NULL
+                   ? Lst_FindFrom(sufflist, succ, SuffSuffIsPrefix, str)
+                   : NULL;
        }
        if (srcLn == NULL) {
            /*



Home | Main Index | Thread Index | Old Index