summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/embryo/embryo_cc_sc1.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bin/embryo/embryo_cc_sc1.c b/src/bin/embryo/embryo_cc_sc1.c
index 1189ce807b..7595be8299 100644
--- a/src/bin/embryo/embryo_cc_sc1.c
+++ b/src/bin/embryo/embryo_cc_sc1.c
@@ -1203,10 +1203,8 @@ declloc(int fstatic)
1203 if (numdim > 0 && dim[numdim - 1] == 0) 1203 if (numdim > 0 && dim[numdim - 1] == 0)
1204 error(52); /* only last dimension may be variable length */ 1204 error(52); /* only last dimension may be variable length */
1205 size = needsub(&idxtag[numdim]); /* get size; size==0 for "var[]" */ 1205 size = needsub(&idxtag[numdim]); /* get size; size==0 for "var[]" */
1206#if INT_MAX < CELL_MAX 1206 if ((unsigned long long)size * sizeof(cell) > MIN(INT_MAX, CELL_MAX))
1207 if (size > INT_MAX)
1208 error(105); /* overflow, exceeding capacity */ 1207 error(105); /* overflow, exceeding capacity */
1209#endif
1210 dim[numdim++] = (int)size; 1208 dim[numdim++] = (int)size;
1211 } /* while */ 1209 } /* while */
1212 if (ident == iARRAY || fstatic) 1210 if (ident == iARRAY || fstatic)
@@ -1237,6 +1235,9 @@ declloc(int fstatic)
1237 } 1235 }
1238 else 1236 else
1239 { 1237 {
1238 if (((unsigned long long)declared + (unsigned long long)size) * sizeof(cell) >
1239 MIN(INT_MAX, CELL_MAX))
1240 error(105);
1240 declared += (int)size; /* variables are put on stack, 1241 declared += (int)size; /* variables are put on stack,
1241 * adjust "declared" */ 1242 * adjust "declared" */
1242 sym = 1243 sym =