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

Howard Hinnant hhinnant at apple.com
Thu Nov 1 11:05:26 PDT 2012


On Nov 1, 2012, at 5:32 AM, Wen-Han Gu (谷汶翰) <wenhan.gu at gmail.com> wrote:

> 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

Thanks for the patch.  Was this on __arm__ and was the symptom an infinite loop?

Howard






More information about the cfe-commits mailing list