Permalink
Browse files

2002-10-03 Dietmar Maurer <dietmar@ximian.com>

	* jit.c (ves_array_element_address): added check for out of range index
	(mono_analyze_stack): added fix for bug #31654

svn path=/trunk/mono/; revision=7958
  • Loading branch information...
1 parent 2c21ef1 commit ca12ccb9ddc8f7651f8db017a1dbe7e6dbfe4a8f Dietmar Maurer committed Oct 3, 2002
Showing with 38 additions and 1 deletion.
  1. +5 −0 mono/jit/ChangeLog
  2. +4 −1 mono/jit/jit.c
  3. +1 −0 mono/tests/Makefile.am
  4. +28 −0 mono/tests/decimal-array.cs
View
5 mono/jit/ChangeLog
@@ -1,3 +1,8 @@
+2002-10-03 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (ves_array_element_address): added check for out of range index
+ (mono_analyze_stack): added fix for bug #31654
+
2002-10-01 Martin Baulig <martin@gnome.org>
* debug.c: Don't create an .il file for the dynamic symbol file.
View
5 mono/jit/jit.c
@@ -832,6 +832,9 @@ ves_array_element_address (MonoArray *this, ...)
this->bounds [i].lower_bound;;
}
+ 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));
//printf ("AADDRESS %p %p %d %d %08X\n", this, ea, ind, esize, *(gpointer *)ea);
@@ -2195,7 +2198,7 @@ mono_analyze_stack (MonoFlowGraph *cfg)
this = mono_ctree_new_leaf (mp, MB_TERM_NOP);
- if (MONO_TYPE_ISSTRUCT (csig->ret)) {
+ if (MONO_TYPE_ISSTRUCT (csig->ret) && !array_rank) {
int size, align;
if (csig->pinvoke)
size = mono_class_native_size (csig->ret->data.klass, &align);
View
1 mono/tests/Makefile.am
@@ -129,6 +129,7 @@ TEST_CS_SRC= \
bound.cs \
array-invoke.cs \
decimal.cs \
+ decimal-array.cs \
marshal1.cs \
marshal2.cs \
marshal3.cs \
View
28 mono/tests/decimal-array.cs
@@ -0,0 +1,28 @@
+using System;
+
+class Test
+{
+ public static int Main()
+ {
+ decimal[,] tab = new decimal[2,2] {{3,4},{5,6}};
+ bool b1 = false;
+ decimal d;
+
+ try {
+ d = tab[1,2];
+ } catch (Exception e) {
+ b1 = true;
+ }
+
+ if (!b1)
+ return 1;
+
+ d = tab[1,1];
+ if (d != 6)
+ return 1;
+
+ return 0;
+ }
+}
+
+

0 comments on commit ca12ccb

Please sign in to comment.