[cfe-commits] [PATCH][libcxxabi] loop boundary bug in personality routine when scanning eh table

Wen-Han Gu (谷汶翰) wenhan.gu at gmail.com
Thu Nov 1 02:32:41 PDT 2012


Dear cfe-commits and libcxxabi developers,

I hit a bug in libc++abi when testing on a gcc testsuite sample.
This can be fixed simply by this small patch.
Please help review it. Thanks in advance!


Index: src/cxa_personality.cpp
===================================================================
--- src/cxa_personality.cpp     (revision 167216)
+++ src/cxa_personality.cpp     (working copy)
@@ -552,7 +552,7 @@
     const uint8_t* callSiteTableEnd = callSiteTableStart +
callSiteTableLength;
     const uint8_t* actionTableStart = callSiteTableEnd;
     const uint8_t* callSitePtr = callSiteTableStart;
-    while (true)
+    while (callSitePtr < callSiteTableEnd)
     {
         // There is one entry per call site.
 #if !__arm__
@@ -782,7 +782,12 @@
             call_terminate(native_exception, unwind_exception);
         }
 #endif  // !__arm__
-    }  // there is no break out of this loop, only return
+    }  // there might be some tricky cases which break out of this loop
+
+    // If we are here, it means no eh table entry specify how to handle
+    // this exception. For example, gcc testsuites eh23 at
+    // <gcc>/gcc/testsuite/g++.old-deja/g++.mike/eh23.C
+    call_terminate(native_exception, unwind_exception);
 }

 // public API



-- 
Best regards,
Wen-Han Gu (Nowar)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121101/6c721209/attachment.html>


More information about the cfe-commits mailing list