* src/reader.c (packgram): Catch nitems overflows.

This commit is contained in:
Akim Demaille
2001-12-27 18:06:41 +00:00
parent 14d293acb2
commit adc8c84856
3 changed files with 14 additions and 0 deletions

View File

@@ -1692,6 +1692,10 @@ packgram (void)
int ruleno;
symbol_list *p;
/* We use short to index items. */
if (nitems >= MAXSHORT)
fatal (_("too many items (max %d)"), MAXSHORT);
ritem = XCALLOC (short, nitems + 1);
rule_table = XCALLOC (rule_t, nrules) - 1;