https://issues.dlang.org/show_bug.cgi?id=19831

FeepingCreature <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |EH, safe, wrong-code
           Severity|regression                  |major

--- Comment #4 from FeepingCreature <[email protected]> ---
Note that this leads to potential memory corruption in @safe:
https://run.dlang.io/is/rP2yXU

And what happens here in detail is that it inspects "current exceptions in
flight" to select the type of handler to jump to, see druntime dwarfeh.d
getClassInfo, but it doesn't at all account for the fact that an exception may
be thrown and caught solely inside the finally handler, never being chained at
all.

To fix this, exception chaining must only happen after the second exception
being thrown passes the finally block originally triggered by the exception
it'll be chained to.

--

Reply via email to