res += t1;
+ if (res < 0)
+ goto raise_exception;
+
if (sign < 0)
return -res;
else
{
MonoClass *class;
va_list ap;
- int i, ind, esize;
+ int i, ind, esize, realidx;
gpointer ea;
MONO_ARCH_SAVE_REGS;
class = this->obj.vtable->klass;
- ind = va_arg(ap, int);
g_assert (this->bounds != NULL);
- ind -= this->bounds [0].lower_bound;
+ esize = mono_array_element_size (class);
+ ind = va_arg(ap, int);
+ ind -= (int)this->bounds [0].lower_bound;
+ if ((guint32)ind >= (guint32)this->bounds [0].length)
+ mono_raise_exception (mono_get_exception_index_out_of_range ());
for (i = 1; i < class->rank; i++) {
- ind = ind*this->bounds [i].length + va_arg(ap, int) -
- this->bounds [i].lower_bound;;
+ realidx = va_arg(ap, int) - (int)this->bounds [i].lower_bound;
+ if ((guint32)realidx >= (guint32)this->bounds [i].length)
+ mono_raise_exception (mono_get_exception_index_out_of_range ());
+ ind *= this->bounds [i].length;
+ ind += realidx;
}
+ esize *= ind;
- if (ind >= this->max_length)
- mono_raise_exception (mono_get_exception_index_out_of_range ());
-
- esize = mono_array_element_size (class);
- ea = (gpointer*)((char*)this->vector + (ind * esize));
+ ea = (gpointer*)((char*)this->vector + esize);
va_end(ap);
mono_class_init (field->parent);
vtable = mono_class_vtable (domain, field->parent);
+ if (!vtable->initialized)
+ mono_runtime_class_init (vtable);
//printf ("SFLDA1 %p\n", (char*)vtable->data + field->offset);