[Mono-bugs] [Bug 668925] ExceptionHandler.HandlerEnd does not "handle" compilers pointing past the end of the instructions

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Feb 8 21:32:06 EST 2011


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

https://bugzilla.novell.com/show_bug.cgi?id=668925#c3


Sebastien Pouliot <spouliot at novell.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Gendarme                    |Cecil
         AssignedTo|mono-bugs at lists.ximian.com  |jbevain at novell.com
            Product|Mono: Tools                 |Mono: Class Libraries
   Target Milestone|---                         |2.10.x
            Summary|Gendarme.Rules.Exceptions.D |ExceptionHandler.HandlerEnd
                   |oNotDestroyStackTraceRule   |does not "handle" compilers
                   |throws                      |pointing past the end of
                   |ArgumentNullException       |the instructions

--- Comment #3 from Sebastien Pouliot <spouliot at novell.com> 2011-02-09 02:32:05 UTC ---
JB, here's my local fix. The final fix needs to be backported to 2-10 :-)

diff --git a/Mono.Cecil.Cil/CodeReader.cs b/Mono.Cecil.Cil/CodeReader.cs
index 4cfc7db..38ec162 100644
--- a/Mono.Cecil.Cil/CodeReader.cs
+++ b/Mono.Cecil.Cil/CodeReader.cs
@@ -348,7 +348,9 @@ namespace Mono.Cecil.Cil {
                 handler.TryEnd = GetInstruction (handler.TryStart.Offset +
read_length ());

                 handler.HandlerStart = GetInstruction (read_entry ());
-                handler.HandlerEnd = GetInstruction
(handler.HandlerStart.Offset + read_length ());
+                // some compilers (e.g. CSC) can point past the last
instruction
+                handler.HandlerEnd = GetInstruction
(handler.HandlerStart.Offset + read_length ()) 
+                    ?? body.instructions [body.instructions.Count - 1];

                 ReadExceptionHandlerSpecific (handler);

-- 
Configure bugmail: https://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