mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-07-23 20:00:33 +00:00
ielr: fix crash on memory management
Reported by Dwight Guth. https://lists.gnu.org/r/bug-bison/2020-06/msg00037.html * src/AnnotationList.c (AnnotationList__computePredecessorAnnotations): Beware that SBITSET__FOR_EACH nests _two_ for-loops, so "break" does not actually break out of it. That was the only occurrence in the code. * src/Sbitset.h (SBITSET__FOR_EACH): Warn passersby.
This commit is contained in:
@@ -44,6 +44,10 @@ GNU Bison NEWS
|
|||||||
string aliases semantically equivalent but syntactically different (e.g.,
|
string aliases semantically equivalent but syntactically different (e.g.,
|
||||||
"A", "\x41", "\101") are considered to be different.
|
"A", "\x41", "\101") are considered to be different.
|
||||||
|
|
||||||
|
*** Crash when generating IELR
|
||||||
|
|
||||||
|
An old, well hidden, bug in the generation of IELR parsers was fixed.
|
||||||
|
|
||||||
** New features
|
** New features
|
||||||
|
|
||||||
*** File prefix mapping
|
*** File prefix mapping
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ Di-an Jan [email protected]
|
|||||||
Dick Streefland [email protected]
|
Dick Streefland [email protected]
|
||||||
Didier Godefroy [email protected]
|
Didier Godefroy [email protected]
|
||||||
Don Macpherson [email protected]
|
Don Macpherson [email protected]
|
||||||
|
Dwight Guth [email protected]
|
||||||
Efi Fogel [email protected]
|
Efi Fogel [email protected]
|
||||||
Enrico Scholz [email protected]
|
Enrico Scholz [email protected]
|
||||||
Eric Blake [email protected]
|
Eric Blake [email protected]
|
||||||
|
|||||||
@@ -276,7 +276,8 @@ AnnotationList__computePredecessorAnnotations (
|
|||||||
obstack_free (annotations_obstackp,
|
obstack_free (annotations_obstackp,
|
||||||
annotation_node->contributions[ci]);
|
annotation_node->contributions[ci]);
|
||||||
annotation_node->contributions[ci] = NULL;
|
annotation_node->contributions[ci] = NULL;
|
||||||
break;
|
// "Break" out of SBITSET__FOR_EACH.
|
||||||
|
goto after_sbitset__for_each;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -309,6 +310,7 @@ AnnotationList__computePredecessorAnnotations (
|
|||||||
predecessor_item);
|
predecessor_item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
after_sbitset__for_each:;
|
||||||
}
|
}
|
||||||
if (annotation_node->contributions[ci])
|
if (annotation_node->contributions[ci])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ void Sbitset__fprint (Sbitset self, Sbitset__Index nbits, FILE *file);
|
|||||||
*ptr_self = *ptr_other1 | *ptr_other2; \
|
*ptr_self = *ptr_other1 | *ptr_other2; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
/* ATTENTION: there are *two* loops here, "break" and "continue" will
|
||||||
|
not apply to the whole loop, just the inner one. */
|
||||||
# define SBITSET__FOR_EACH(SELF, NBITS, ITER, INDEX) \
|
# define SBITSET__FOR_EACH(SELF, NBITS, ITER, INDEX) \
|
||||||
for ((ITER) = (SELF); (ITER) < (SELF) + Sbitset__nbytes (NBITS); ++(ITER)) \
|
for ((ITER) = (SELF); (ITER) < (SELF) + Sbitset__nbytes (NBITS); ++(ITER)) \
|
||||||
if (*(ITER) != 0) \
|
if (*(ITER) != 0) \
|
||||||
|
|||||||
Reference in New Issue
Block a user