[armedbear-cvs] r14135 - trunk/abcl/src/org/armedbear/lisp

rschlatte at common-lisp.net rschlatte at common-lisp.net
Sun Aug 26 15:09:29 UTC 2012


Author: rschlatte
Date: Sun Aug 26 08:09:27 2012
New Revision: 14135

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

- Reported by Pascal Costanza

Modified:
   trunk/abcl/src/org/armedbear/lisp/StandardObject.java

Modified: trunk/abcl/src/org/armedbear/lisp/StandardObject.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/StandardObject.java	Sat Aug 25 14:14:49 2012	(r14134)
+++ trunk/abcl/src/org/armedbear/lisp/StandardObject.java	Sun Aug 26 08:09:27 2012	(r14135)
@@ -473,7 +473,23 @@
     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;
     }
   };




More information about the armedbear-cvs mailing list