]> git.saurik.com Git - bison.git/blobdiff - src/reader.c
* src/reader.c (packgram): Catch nitems overflows.
[bison.git] / src / reader.c
index b5d5fac991de6ab08acc7ccd7f46efdf6ed0dcdc..d19126240f06ea7577194c231a5fa1e08dd8899b 100644 (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;