[Issue 19831] throw/catch in scope(exit) crashes with illegal instruction

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 3 06:19:28 UTC 2019


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

FeepingCreature <default_357-line at yahoo.de> changed:

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

--- Comment #4 from FeepingCreature <default_357-line at yahoo.de> ---
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.

--


More information about the Digitalmars-d-bugs mailing list