Changes: Carolyn Oates
Edwin Steiner
- $Id: parse.c 772 2003-12-14 12:24:02Z edwin $
+ $Id: parse.c 813 2003-12-31 00:21:52Z edwin $
*/
block_insert(p);
p = raw_extable[i].endpc;
+ if (p <= raw_extable[i].startpc)
+ panic("Invalid exception handler range");
if (label_index != NULL) p = label_index[p];
extable[i].endpc = p;
bound_check1(p);
{
s4 num, j;
s4 *tablep;
+ s4 prevvalue;
blockend = true;
nextp = ALIGN((p + 1), 4);
tablep++;
nextp += 4;
+ /* check if the lookup table is sorted correctly */
+
+ if (i && (j <= prevvalue))
+ panic("invalid LOOKUPSWITCH: table not sorted");
+ prevvalue = j;
+
/* target */
j = p + code_get_s4(nextp);
tablep++;
nextp += 4;
- num -= j;
+ num -= j; /* difference of upper - lower */
+ if (num < 0)
+ panic("invalid TABLESWITCH: upper bound < lower bound");
if (nextp + 4*(num+1) > jcodelength)
panic("Unexpected end of bytecode");
Changes: Carolyn Oates
Edwin Steiner
- $Id: parse.c 772 2003-12-14 12:24:02Z edwin $
+ $Id: parse.c 813 2003-12-31 00:21:52Z edwin $
*/
block_insert(p);
p = raw_extable[i].endpc;
+ if (p <= raw_extable[i].startpc)
+ panic("Invalid exception handler range");
if (label_index != NULL) p = label_index[p];
extable[i].endpc = p;
bound_check1(p);
{
s4 num, j;
s4 *tablep;
+ s4 prevvalue;
blockend = true;
nextp = ALIGN((p + 1), 4);
tablep++;
nextp += 4;
+ /* check if the lookup table is sorted correctly */
+
+ if (i && (j <= prevvalue))
+ panic("invalid LOOKUPSWITCH: table not sorted");
+ prevvalue = j;
+
/* target */
j = p + code_get_s4(nextp);
tablep++;
nextp += 4;
- num -= j;
+ num -= j; /* difference of upper - lower */
+ if (num < 0)
+ panic("invalid TABLESWITCH: upper bound < lower bound");
if (nextp + 4*(num+1) > jcodelength)
panic("Unexpected end of bytecode");