Commit a49489a0 authored by rschlatte@1c010e3e-69d0-11dd-93a8-456734b0d56f's avatar rschlatte@1c010e3e-69d0-11dd-93a8-456734b0d56f
Browse files

Catch out-of-bounds exception in standard-instance-access

- Reported by Pascal Costanza
parent 8206e18a
......@@ -473,7 +473,23 @@ public class StandardObject extends LispObject
public LispObject execute(LispObject first, LispObject second,
LispObject third)
{
checkStandardObject(first).slots[Fixnum.getValue(second)] = third; // FIXME
final StandardObject instance = checkStandardObject(first);
final int index;
if (second instanceof Fixnum) {
index = ((Fixnum)second).value;
} else {
return type_error(second,
list(Symbol.INTEGER, Fixnum.ZERO,
Fixnum.getInstance(instance.slots.length)));
}
try {
instance.slots[index] = third;
} catch (ArrayIndexOutOfBoundsException e) {
return type_error(second,
list(Symbol.INTEGER, Fixnum.ZERO,
Fixnum.getInstance(instance.slots.length)));
}
return third;
}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment