[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 18:22:13 PDT 2012


Hello Howard,

It did happen on ARM and x86_32, and I guess all targets have this bug.
This bug behaves depending on the upcoming entry, might be nothing,
infinite loop, other errors...

Thanks.


2012/11/2 Howard Hinnant <hhinnant at apple.com>

> 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
>
>
>


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


More information about the cfe-commits mailing list