Author: kumpera
Date: 2007-12-31 14:41:26 -0500 (Mon, 31 Dec 2007)
New Revision: 92072

Added:
   trunk/mono/mono/tests/invalid-token.il
Modified:
   trunk/mono/mono/tests/ChangeLog
   trunk/mono/mono/tests/Makefile.am
Log:
2007-12-31  Rodrigo Kumpera  <[EMAIL PROTECTED]>

        * invalid-token.il, Makefile.am: Add test for loading
        invalid tokens.



Modified: trunk/mono/mono/tests/ChangeLog
===================================================================
--- trunk/mono/mono/tests/ChangeLog     2007-12-31 19:33:31 UTC (rev 92071)
+++ trunk/mono/mono/tests/ChangeLog     2007-12-31 19:41:26 UTC (rev 92072)
@@ -1,3 +1,8 @@
+2007-12-31  Rodrigo Kumpera  <[EMAIL PROTECTED]>
+
+       * invalid-token.il, Makefile.am: Add test for loading
+       invalid tokens.
+
 2007-12-20  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * Makefile.am: Enable the async-exc-compilation test on x86/amd64.

Modified: trunk/mono/mono/tests/Makefile.am
===================================================================
--- trunk/mono/mono/tests/Makefile.am   2007-12-31 19:33:31 UTC (rev 92071)
+++ trunk/mono/mono/tests/Makefile.am   2007-12-31 19:41:26 UTC (rev 92072)
@@ -297,7 +297,8 @@
        even-odd.il             \
        bug-82022.il    \
        vt-sync-method.il       \
-       enum_types.il
+       enum_types.il   \
+       invalid-token.il
 
 #      bug-318677.il
 

Added: trunk/mono/mono/tests/invalid-token.il
===================================================================
--- trunk/mono/mono/tests/invalid-token.il      2007-12-31 19:33:31 UTC (rev 
92071)
+++ trunk/mono/mono/tests/invalid-token.il      2007-12-31 19:41:26 UTC (rev 
92072)
@@ -0,0 +1,66 @@
+/*
+This test an invalid methoddef token
+*/
+.assembly extern mscorlib
+{
+  .ver 2:0:0:0
+  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
+}
+.assembly 'bla'
+{
+  .hash algorithm 0x00008004
+  .ver  0:0:0:0
+}
+.module ld_type.exe
+
+.class public auto ansi beforefieldinit Driver
+        extends [mscorlib]System.Object
+{
+       .method public static void Misc() {
+               ret
+       }
+
+        .method public static void InvalidMethodDef ()
+        {
+               .maxstack 2
+                .locals init (int32 bla)
+               nop
+               call void Driver::Misc()
+               /*Token is 0x00AAAA, which is well beyond the numbers of 
methods here.*/
+               .emitbyte 0xFE
+               .emitbyte 0x06
+               .emitbyte 0xAA
+               .emitbyte 0xAA
+               .emitbyte 0x00
+               .emitbyte 0x06
+               pop
+               ret
+
+        }
+
+        .method public static int32 Main ()
+        {
+               .entrypoint
+               .maxstack 8
+               .locals init (int32 V0)
+               .try {
+                       call void Driver::InvalidMethodDef()
+                       //mini.c inline_method doesn't clean loader errors, 
meaning that System.Console fails with BadImageException
+                       //ldstr "InvalidMethodDef() should throw 
BadImageException"
+                       //call void class 
[mscorlib]System.Console::WriteLine(string)
+                       ldc.i4.1
+                       stloc.0
+                       leave END
+               } catch [mscorlib]System.BadImageFormatException { 
+                       pop 
+                       ldc.i4.0 
+                       stloc.0
+                       leave END
+               }
+END:
+               ldloc.0
+               ret
+       }
+}
+
+

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to