Piotr Caban : msvcrt: Register exception object before unwinding.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Mar 22 10:55:11 CDT 2016


Module: wine
Branch: master
Commit: 3a0b3c5bc89178d332dd1117348d8785975afc18
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3a0b3c5bc89178d332dd1117348d8785975afc18

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Mar 21 19:16:06 2016 +0100

msvcrt: Register exception object before unwinding.

Thrown object was incorrectly freed in following situation:
try {
     try {
         throw obj;
     } catch(...) {
         throw;
     }
} catch(...) {
     //use object here
}

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/except_i386.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcrt/except_i386.c b/dlls/msvcrt/except_i386.c
index 9adda79..3debece 100644
--- a/dlls/msvcrt/except_i386.c
+++ b/dlls/msvcrt/except_i386.c
@@ -446,6 +446,8 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, cxx_exception_frame
                 TRACE("found catch(...) block\n");
             }
 
+            __CxxRegisterExceptionObject(&rec, &nested_frame.frame_info);
+
             /* unwind the stack */
             RtlUnwind( catch_frame ? catch_frame : &frame->frame, 0, rec, 0 );
             cxx_local_unwind( frame, descr, tryblock->start_level );
@@ -457,12 +459,10 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, cxx_exception_frame
                    catchblock, catchblock->handler, &frame->ebp );
 
             /* setup an exception block for nested exceptions */
-
             nested_frame.frame.Handler = catch_function_nested_handler;
             nested_frame.cxx_frame = frame;
             nested_frame.descr     = descr;
             nested_frame.trylevel  = nested_trylevel + 1;
-            __CxxRegisterExceptionObject(&rec, &nested_frame.frame_info);
 
             __wine_push_frame( &nested_frame.frame );
             addr = call_ebp_func( catchblock->handler, &frame->ebp );




More information about the wine-cvs mailing list