Bugzilla – Bug 324864
[PATCH]Assembly.GetTypes with generics causes SIGSEGV
Last modified: 2007-09-15 21:24:46 UTC
---- Reported by billholmes54@gmail.com 2007-07-26 10:15:58 MST ---- Steps to reproduce the problem: 1. Download attached sample files 2. gmcs MyLib.cs -t:library 3. gmcs runner.cs 4. mono runner.exe Actual Results: SIGSEGV Expected Results: MyLib.ObjectContainer`1[T] MyLib.DocumentObject MyLib.DomainObject This is a bug that has show up in the last week and is in the 1.2.5 branch. I have also created and attached a patch for mono_type_create_from_typespec. The crash occurs in mono_generic_class_get_class when gclass is dereferenced. This occurs because mono_type_create_from_typespec adds a type to the image’s typespec_cache hash table that is not completely initialized. Then the call to init the type do_mono_metadata_parse_type causes mono_type_create_from_typespec to be called again later for the same type spec for this case. The type is found in the hash map, still not initialized, and is simply returned on line 4156. This later causes a crash in mono_type_create_from_typespec. My proposed patch is in mono_type_create_from_typespec to not add the type to the hash map until after the call to do_mono_metadata_parse_type has succeeded. But before I add the type to the hash map I check to be sure it has not already been added recursively. If is has been added I free the locally created type object and return the type that was found. Please let me know if this is ok to commit. (holmes IRC) ---- Additional Comments From billholmes54@gmail.com 2007-07-26 10:16:23 MST ---- Created an attachment (id=172347) Sample Code ---- Additional Comments From billholmes54@gmail.com 2007-07-26 10:16:38 MST ---- Created an attachment (id=172348) Sample Code ---- Additional Comments From billholmes54@gmail.com 2007-07-26 10:23:25 MST ---- Created an attachment (id=172349) proposed patch - make check approved ;) ---- Additional Comments From lupus@ximian.com 2007-07-31 13:45:54 MST ---- *** https://bugzilla.novell.com/show_bug.cgi?id=MONO82246 has been marked as a duplicate of this bug. *** ---- Additional Comments From billholmes54@gmail.com 2007-07-31 14:57:39 MST ---- committed to trunk r83127. committed to 1.2.4 branch r83128. Will commit a test case to trunk soon. ---- Additional Comments From sebastien@ximian.com 2007-08-01 10:02:01 MST ---- The applied patch has broken the CAS tests on the x86 bot http://mono.ximian.com/monobuild/builds/HEAD/sles-9-i586/mono/83139/logs/test-cas.log ---- Additional Comments From sebastien@ximian.com 2007-08-01 10:38:35 MST ---- oops, wrong alarm. the failures are due to the permview update (and I forgot to include mcs in the binary search) ---- Additional Comments From billholmes54@gmail.com 2007-08-01 15:29:36 MST ---- Test added at r83233 Imported an attachment (id=172347) Imported an attachment (id=172348) Imported an attachment (id=172349) Unknown bug field "cf_op_sys_details" encountered while moving bug <cf_op_sys_details>SUSE 10.2</cf_op_sys_details> Unknown operating system other. Setting to default OS "Other".