[Mono-bugs] [Bug 499988] New: Unhandled Exception: System.InvalidCastException: Cannot cast from source type to destination type. at Mono.CSharp.BaseAccess.CommonResolve

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri May 1 00:04:00 EDT 2009


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


           Summary: Unhandled Exception: System.InvalidCastException:
                    Cannot cast from source type to destination type.  at
                    Mono.CSharp.BaseAccess.CommonResolve
    Classification: Mono
           Product: Mono: Compilers
           Version: 1.9
          Platform: x86-64
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: dzonatas at dzonux.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.7)
Gecko/2009032813 Iceweasel/3.0.6 (Debian-3.0.6-1)

The included example is not syntactically correct, but instead of a graceful
exception and exit the mono compiler vm crashes. If this is truly unhandled,
then it may cause runtime environments to crash, which could be a security
grief.

The exception is caused when an abstract class has a delegate with the same
name of a method in derived class. There is unreachable code triggered. The
base delegate was attempted to be called in the unreachable state. The
exception is not properly caught and the runtime exits.



Reproducible: Always

Steps to Reproduce:
..
       class test2 : test
           {
           int meth( bool b )
               {
               return 1 ;
               base.meth( true ) ;
               }
           }
       abstract class test
           {
           delegate void meth( bool b ) ;
           } 
..
Actual Results:  
Exception caught by the compiler while compiling:
  Block that caused the problem begin at:
/home/dzonatas/workspace/example.cs(30,29):
                    Block being compiled:
[/home/dzonatas/workspace/example.cs(31,33):,/home/dzonatas/workspace/.example.cs(34,33):]
System.InvalidCastException: Cannot cast from source type to destination type.
Internal compiler error at /home/dzonatas/workspace/example.cs(30,29)::
exception caught while emitting MethodBuilder [test2::meth]

Unhandled Exception: System.InvalidCastException: Cannot cast from source type
to destination type.
 at Mono.CSharp.BaseAccess.CommonResolve (Mono.CSharp.EmitContext ec) [0x00000]
 at Mono.CSharp.BaseAccess.DoResolve (Mono.CSharp.EmitContext ec) [0x00000]
 at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec, ResolveFlags
flags) [0x00000]
 at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.EmitContext ec) [0x00000]
 at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec, ResolveFlags
flags) [0x00000]
 at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
 at Mono.CSharp.ExpressionStatement.ResolveStatement (Mono.CSharp.EmitContext
ec) [0x00000]
 at Mono.CSharp.StatementExpression.Resolve (Mono.CSharp.EmitContext ec)
[0x00000]
 at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
 at Mono.CSharp.EmitContext.ResolveTopBlock (Mono.CSharp.EmitContext
anonymous_method_host, Mono.CSharp.ToplevelBlock block, Mono.CSharp.Parameters
ip, IMethodData md, System.Boolean& unreachable) [0x00000] 

Expected Results:  
I expected it to error about the improper abstraction and unreachable code, but
not crash the vm.

-- 
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