[Mono-bugs] [Bug 567109] New: segmentation violation while compiling a C# module that worked in 2.4.2.3

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Dec 23 15:44:43 EST 2009


http://bugzilla.novell.com/show_bug.cgi?id=567109

http://bugzilla.novell.com/show_bug.cgi?id=567109#c0


           Summary: segmentation violation while compiling a C# module
                    that worked in 2.4.2.3
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: khester at pacificbiosciences.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Description of Problem: We are using Mono for a large hardware/software
project.  After upgrading to mono 2.6.1 we found a crashing bug when gmcs was
trying to compile one of our modules.  

I'm attaching a fix for the null reference that occurs while compiling an
Indexer contained within a Class.  Unfortunately, I haven't yet extracted a
test case out of the (large/interdependent) class that shows the problem.

I hope that the developer for mono/metadata/reflection.c can look at this patch
and I suspect they will already know that in some cases method->klass can be
NULL.
n:

Here is the fix:

--- mono-2.6.1.orig/mono/metadata/reflection.c    2009-12-17 01:48:22.000000000
-0800
+++ mono-2.6.1/mono/metadata/reflection.c    2009-12-23 12:13:54.000000000
-0800
@@ -8430,6 +8430,12 @@
     if (method->is_inflated)
         method = ((MonoMethodInflated *) method)->declaring;

+    // kevinh - my test case is complex, but it used to compile fine with
2.4.2.3
+    // I had to add the following two lines to get my failing code to not
+    // bomb out in the compiler
+    if(!method->klass)
+        return NULL;
+
     if (method->klass->image->dynamic) {
         MonoCustomAttrInfo *res, *ainfo;
         int size;


Here is the stack trace from the crash:


Stacktrace:

  at (wrapper managed-to-native) System.MonoCustomAttrs.IsDefinedInternal
(System.Reflection.ICustomAttributeProvider,System.Type) <0x0004b>
  at (wrapper managed-to-native) System.MonoCustomAttrs.IsDefinedInternal
(System.Reflection.ICustomAttributeProvider,System.Type) <0x0004b>
  at System.MonoCustomAttrs.IsDefined
(System.Reflection.ICustomAttributeProvider,System.Type,bool) <0x00067>
  at System.Reflection.ParameterInfo.IsDefined (System.Type,bool) <0x00023>
  at Mono.CSharp.ParametersImported.Create
(System.Reflection.ParameterInfo[],System.Reflection.MethodBase) <0x00308>
  at Mono.CSharp.TypeManager.GetParameterData (System.Reflection.PropertyInfo)
<0x000d7>
  at Mono.CSharp.MemberCache.FindMemberToOverride
(System.Type,string,Mono.CSharp.AParametersCollection,Mono.CSharp.GenericMethod,bool)
<0x00273>
  at Mono.CSharp.Indexer.ResolveBaseProperty () <0x00067>
  at Mono.CSharp.PropertyBase.FindOutBaseMethod (System.Type&) <0x0002f>
  at Mono.CSharp.InterfaceMemberBase.CheckBase () <0x0010f>
  at Mono.CSharp.Indexer.Define () <0x00269>
  at Mono.CSharp.TypeContainer/MemberCoreArrayList.DefineContainerMembers ()
<0x000af>
  at Mono.CSharp.TypeContainer.DefineContainerMembers
(Mono.CSharp.TypeContainer/MemberCoreArrayList) <0x0001e>
  at Mono.CSharp.Class.DefineContainerMembers
(Mono.CSharp.TypeContainer/MemberCoreArrayList) <0x00073>
  at Mono.CSharp.TypeContainer.DoDefineMembers () <0x00fd3>
  at Mono.CSharp.Class.DoDefineMembers () <0x0004f>
  at Mono.CSharp.TypeContainer.Define () <0x0002f>
  at Mono.CSharp.ClassOrStruct.Define () <0x00017>
  at Mono.CSharp.Class.Define () <0x0013f>
  at Mono.CSharp.RootContext.PopulateTypes () <0x00358>
  at Mono.CSharp.Driver.Compile () <0x007ab>
  at Mono.CSharp.Driver.Main (string[]) <0x000ab>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object
(object,intptr,intptr,intptr) <0x00054>



Thread 1 (Thread 0x7fb25d61e720 (LWP 22948)):
#0  0x00007fb25c9405cb in read () from /lib/libpthread.so.0
#1  0x000000000048b638 in mono_handle_native_sigsegv (signal=<value optimized
out>, ctx=<value optimized out>) at mini-exceptions.c:1809
#2  0x00000000004d440d in mono_arch_handle_altstack_exception
(sigctx=0x7fb25d628c40, fault_addr=<value optimized out>, stack_ovf=0)
    at exceptions-amd64.c:879
#3  <signal handler called>
#4  0x000000000056d6b6 in mono_custom_attrs_from_param (method=0x7fb255bf9a50,
param=1) at reflection.c:8434
#5  0x00000000005247a6 in custom_attrs_defined_internal (obj=0x7fb255bf9a50,
attr_type=0x1) at icall.c:7227
#6  0x0000000040a7429b in ?? ()
#7  0x000000000092e3f0 in ?? ()
#8  0x0000000000000000 in ?? ()

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list