Mon Apr 15 11:37:33 CEST 2002 Paolo Molaro <lupus@ximian.com>
[mono.git] / mono / metadata / verify.c
index 2b08317675728787ffa2425f308b5ab9e2ecb1f9..7015fd825eacb23886cf7940a5b7bb498e065146 100644 (file)
@@ -113,16 +113,16 @@ is_valid_assembly_flags (guint32 flags) {
 }
 
 static int
-is_valid_blob (MonoImage *image, guint32 index, int notnull)
+is_valid_blob (MonoImage *image, guint32 blob_index, int notnull)
 {
        guint32 size;
-       const char *p, *send;
+       const char *p, *blob_end;
        
-       if (index >= image->heap_blob.size)
+       if (blob_index >= image->heap_blob.size)
                return 0;
-       p = mono_metadata_blob_heap (image, index);
-       size = mono_metadata_decode_blob_size (p, &send);
-       if (index + size + (send-p) > image->heap_blob.size)
+       p = mono_metadata_blob_heap (image, blob_index);
+       size = mono_metadata_decode_blob_size (p, &blob_end);
+       if (blob_index + size + (blob_end-p) > image->heap_blob.size)
                return 0;
        if (notnull && !size)
                return 0;
@@ -130,20 +130,20 @@ is_valid_blob (MonoImage *image, guint32 index, int notnull)
 }
 
 static const char*
-is_valid_string (MonoImage *image, guint32 index, int notnull)
+is_valid_string (MonoImage *image, guint32 str_index, int notnull)
 {
-       const char *p, *send, *res;
+       const char *p, *blob_end, *res;
        
-       if (index >= image->heap_strings.size)
+       if (str_index >= image->heap_strings.size)
                return NULL;
-       res = p = mono_metadata_string_heap (image, index);
-       send = mono_metadata_string_heap (image, image->heap_strings.size - 1);
+       res = p = mono_metadata_string_heap (image, str_index);
+       blob_end = mono_metadata_string_heap (image, image->heap_strings.size - 1);
        if (notnull && !*p)
                return 0;
        /* 
         * FIXME: should check it's a valid utf8 string, too.
         */
-       while (p <= send) {
+       while (p <= blob_end) {
                if (!*p)
                        return res;
                ++p;
@@ -1926,6 +1926,7 @@ delegate_fields[] = {
        {"m_target", G_STRUCT_OFFSET (MonoDelegate, target)},
        {"method_name", G_STRUCT_OFFSET (MonoDelegate, method_name)},
        {"method_ptr", G_STRUCT_OFFSET (MonoDelegate, method_ptr)},
+       {"delegate_trampoline", G_STRUCT_OFFSET (MonoDelegate, delegate_trampoline)},
        {"method_info", G_STRUCT_OFFSET (MonoDelegate, method_info)},
        {NULL, 0}
 };
@@ -1956,9 +1957,41 @@ system_classes_to_check [] = {
        {NULL, NULL}
 };
 
+static FieldDesc 
+mono_method_message_fields[] = {
+       {"method", G_STRUCT_OFFSET (MonoMethodMessage, method)},
+       {"args", G_STRUCT_OFFSET (MonoMethodMessage, args)},
+       {"names", G_STRUCT_OFFSET (MonoMethodMessage, names)},
+       {"arg_types", G_STRUCT_OFFSET (MonoMethodMessage, arg_types)},
+       {"ctx", G_STRUCT_OFFSET (MonoMethodMessage, ctx)},
+       {"rval", G_STRUCT_OFFSET (MonoMethodMessage, rval)},
+       {"exc", G_STRUCT_OFFSET (MonoMethodMessage, exc)},
+       {NULL, 0}
+};
+
 static const ClassDesc
 messaging_classes_to_check [] = {
        {"AsyncResult", async_result_fields},
+       {"MonoMethodMessage", mono_method_message_fields},
+       {NULL, NULL}
+};
+
+static FieldDesc 
+transparent_proxy_fields[] = {
+       {"_rp", G_STRUCT_OFFSET (MonoTransparentProxy, rp)},
+       {NULL, 0}
+};
+
+static FieldDesc 
+real_proxy_fields[] = {
+       {"class_to_proxy", G_STRUCT_OFFSET (MonoRealProxy, class_to_proxy)},
+       {NULL, 0}
+};
+
+static const ClassDesc
+proxy_classes_to_check [] = {
+       {"TransparentProxy", transparent_proxy_fields},
+       {"RealProxy", real_proxy_fields},
        {NULL, NULL}
 };
 
@@ -1982,6 +2015,7 @@ typedef struct {
 
 static const NameSpaceDesc
 namespaces_to_check[] = {
+       {"System.Runtime.Remoting.Proxies", proxy_classes_to_check},
        {"System.Runtime.Remoting.Messaging", messaging_classes_to_check},
        {"System.Reflection.Emit", emit_classes_to_check},
        {"System.Reflection", reflection_classes_to_check},