[mono/mono] [2 commits] 7a4f59d1: For module handles, only check that rva's are within the image size.

"Zoltan Varga ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <000001418bf9bfc5-069a514e-45d1-471c-926f-a3e08cfae89f-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/dd197f0c5f85...f4ada63ae80d

   Commit: 7a4f59d1210fb39fd6abadf2f8af5d34e520b924
   Author: Vincent Povirk <[email protected]> 
     Date: 2013-10-04 18:33:56 GMT
      URL: https://github.com/mono/mono/commit/7a4f59d1210fb39fd6abadf2f8af5d34e520b924

For module handles, only check that rva's are within the image size.

This commit licensed as MIT/X11.

Changed paths:
  M mono/metadata/image.c

Modified: mono/metadata/image.c
===================================================================
@@ -151,7 +151,16 @@ struct ImageUnloadHook {
 	const int top = iinfo->cli_section_count;
 	MonoSectionTable *tables = iinfo->cli_section_tables;
 	int i;
-	
+
+#ifdef HOST_WIN32
+	if (image->is_module_handle) {
+		if (addr && addr < image->raw_data_len)
+			return image->raw_data + addr;
+		else
+			return NULL;
+	}
+#endif
+
 	for (i = 0; i < top; i++){
 		if ((addr >= tables->st_virtual_address) &&
 		    (addr < tables->st_virtual_address + tables->st_raw_data_size)){
@@ -159,10 +168,6 @@ struct ImageUnloadHook {
 				if (!mono_image_ensure_section_idx (image, i))
 					return NULL;
 			}
-#ifdef HOST_WIN32
-			if (image->is_module_handle)
-				return image->raw_data + addr;
-#endif
 			return (char*)iinfo->cli_sections [i] +
 				(addr - tables->st_virtual_address);
 		}

   Commit: f4ada63ae80d76d4628107041ed675c89f6e9a6f
   Author: Zoltan Varga <[email protected]> (vargaz)
     Date: 2013-10-06 04:12:58 GMT
      URL: https://github.com/mono/mono/commit/f4ada63ae80d76d4628107041ed675c89f6e9a6f

Merge pull request #771 from madewokherd/rvamap

For module handles, only check that rva's are within the image size.

Changed paths:
  M mono/metadata/image.c

Modified: mono/metadata/image.c
===================================================================
@@ -151,7 +151,16 @@ struct ImageUnloadHook {
 	const int top = iinfo->cli_section_count;
 	MonoSectionTable *tables = iinfo->cli_section_tables;
 	int i;
-	
+
+#ifdef HOST_WIN32
+	if (image->is_module_handle) {
+		if (addr && addr < image->raw_data_len)
+			return image->raw_data + addr;
+		else
+			return NULL;
+	}
+#endif
+
 	for (i = 0; i < top; i++){
 		if ((addr >= tables->st_virtual_address) &&
 		    (addr < tables->st_virtual_address + tables->st_raw_data_size)){
@@ -159,10 +168,6 @@ struct ImageUnloadHook {
 				if (!mono_image_ensure_section_idx (image, i))
 					return NULL;
 			}
-#ifdef HOST_WIN32
-			if (image->is_module_handle)
-				return image->raw_data + addr;
-#endif
 			return (char*)iinfo->cli_sections [i] +
 				(addr - tables->st_virtual_address);
 		}


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.