https://bugzilla.novell.com/show_bug.cgi?id=656005

https://bugzilla.novell.com/show_bug.cgi?id=656005#c0


           Summary: cecil/light NRE in TypeReference.Resolve()
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Cecil
        AssignedTo: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
          Found By: ---
           Blocker: ---


TypeReference.Resolve can cause a NRE when a TypeSpecification is created with
a null TypeReference.

This occurs for both FunctionPointerType and PointerType (I hit both cases but
I did not look for others).

This can be duplicated by running Gendarme on
https://bugzilla.novell.com/attachment.cgi?id=353658 from bug
https://bugzilla.novell.com/show_bug.cgi?id=582823

This can be fixed with the following patch.

diff --git a/Mono.Cecil/TypeSpecification.cs b/Mono.Cecil/TypeSpecification.c
index d484eff..5469192 100644
--- a/Mono.Cecil/TypeSpecification.cs
+++ b/Mono.Cecil/TypeSpecification.cs
@@ -78,7 +78,9 @@ namespace Mono.Cecil {
                }

                public sealed override TypeReference GetElementType ()
-               {
+               {
+                       if (element_type == null)
+                               return this;
                        return element_type.GetElementType ();
                }
        }

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to