bug-bison
[Top][All Lists]
Advanced

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

Re: array access bugs in bison-1.875


From: Paul Eggert
Subject: Re: array access bugs in bison-1.875
Date: 03 May 2003 23:34:28 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Olatunji Oluwabukunmi Ruwase <address@hidden> writes:

> Please could you check this and confirm.

Thanks for reporting this.  7 of the errors seem to be equivalent to
the following error reported by Andrew Suffield on February 3:
<http://mail.gnu.org/archive/html/bug-bison/2003-02/msg00003.html>
for which I installed this patch on February 4:
<http://mail.gnu.org/archive/html/bug-bison/2003-02/msg00004.html>

The last error (reported in closure.c) is a new one to me, though.
It appears to be a subscript error in lib/bitset.h.  I installed the
following patch.  Can you please verify that it fixes your problem?
Thanks.

2003-05-03  Paul Eggert  <address@hidden>

        * lib/bitset.h (BITSET_FOR_EACH, BITSET_FOR_EACH_REVERSE):
        Do not overrun array bounds.
        This should fix a bug reported today by Olatunji Oluwabukunmi in
        <http://mail.gnu.org/archive/html/bug-bison/2003-05/msg00004.html>.

--- lib/bitset.h        13 Nov 2002 07:02:51 -0000      1.11
+++ lib/bitset.h        4 May 2003 06:29:51 -0000       1.12
@@ -1,5 +1,5 @@
 /* Generic bitsets.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
    Contributed by Michael Hayes (address@hidden).
 
 This program is free software; you can redistribute it and/or modify
@@ -292,7 +292,6 @@ extern void bitset_dump PARAMS ((FILE *,
    bitset_bindex i;
    bitset_iterator iter;
 
-   bitset_zero (dst);
    BITSET_FOR_EACH (iter, src, i, 0)
    {
       printf ("%ld ", i);
@@ -303,7 +302,9 @@ extern void bitset_dump PARAMS ((FILE *,
        (ITER.num == BITSET_LIST_SIZE)                                        \
        && (ITER.num = bitset_list (BSET, ITER.list,                          \
                                   BITSET_LIST_SIZE, &ITER.next));)           \
-    for (ITER.i = 0; (BIT) = ITER.list[ITER.i], ITER.i < ITER.num; ITER.i++)
+    for (ITER.i = 0;                                                         \
+        ITER.i < ITER.num && ((BIT) = ITER.list[ITER.i], 1);                 \
+        ITER.i++)
 
 
 /* Loop over all elements of BSET, in reverse order starting with
@@ -313,7 +314,6 @@ extern void bitset_dump PARAMS ((FILE *,
    bitset_bindex i;
    bitset_iterator iter;
 
-   bitset_zero (dst);
    BITSET_FOR_EACH_REVERSE (iter, src, i, 0)
    {
       printf ("%ld ", i);
@@ -324,7 +324,9 @@ extern void bitset_dump PARAMS ((FILE *,
        (ITER.num == BITSET_LIST_SIZE)                                        \
        && (ITER.num = bitset_list_reverse (BSET, ITER.list,                  \
                                          BITSET_LIST_SIZE, &ITER.next));)    \
-    for (ITER.i = 0; (BIT) = ITER.list[ITER.i], ITER.i < ITER.num; ITER.i++)
+    for (ITER.i = 0;                                                         \
+        ITER.i < ITER.num && ((BIT) = ITER.list[ITER.i], 1);                 \
+        ITER.i++)
 
 
 /* Define set operations in terms of logical operations.  */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]