Changeset 14135


Ignore:
Timestamp:
08/26/12 15:09:27 (9 years ago)
Author:
rschlatte
Message:

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

  • Reported by Pascal Costanza
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/StandardObject.java

    r14113 r14135  
    474474                              LispObject third)
    475475    {
    476       checkStandardObject(first).slots[Fixnum.getValue(second)] = third; // FIXME
     476      final StandardObject instance = checkStandardObject(first);
     477      final int index;
     478      if (second instanceof Fixnum) {
     479        index = ((Fixnum)second).value;
     480      } else {
     481        return type_error(second,
     482                          list(Symbol.INTEGER, Fixnum.ZERO,
     483                               Fixnum.getInstance(instance.slots.length)));
     484      }
     485
     486      try {
     487        instance.slots[index] = third;
     488      } catch (ArrayIndexOutOfBoundsException e) {
     489        return type_error(second,
     490                          list(Symbol.INTEGER, Fixnum.ZERO,
     491                               Fixnum.getInstance(instance.slots.length)));
     492      }
    477493      return third;
    478494    }
Note: See TracChangeset for help on using the changeset viewer.