Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/lint1 lint: fix undefined behavior after synta...



details:   https://anonhg.NetBSD.org/src/rev/d0f5775f5d8e
branches:  trunk
changeset: 379919:d0f5775f5d8e
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jun 27 13:59:29 2021 +0000

description:
lint: fix undefined behavior after syntax error 'unnamed member'

There should really be a linter or other check that guards against
forgetting to assign a value to '$$'.

diffstat:

 usr.bin/xlint/lint1/cgram.y |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 8b34799f3fc2 -r d0f5775f5d8e usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Sun Jun 27 12:26:33 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Sun Jun 27 13:59:29 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.231 2021/06/27 08:20:50 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.232 2021/06/27 13:59:29 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.231 2021/06/27 08:20:50 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.232 2021/06/27 13:59:29 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -850,6 +850,7 @@ member_declaration:
                } else {
                        /* syntax error '%s' */
                        error(249, "unnamed member");
+                       $$ = NULL;
                }
          }
        | error {



Home | Main Index | Thread Index | Old Index