ubsan: check type_info equality via strcmp

Richard Smith richard at metafoo.co.uk
Fri Aug 16 12:36:19 PDT 2013


On Fri, Aug 16, 2013 at 12:29 PM, Jonathan Sauer <jonathan.sauer at gmx.de>wrote:

> Hello,
>
> > Another approach I'd be comfortable with would be to perform a second
> pass looking for a string match if the pointer match fails, and to emit a
> differently-worded message in that case (explaining that the problem might
> be due to an RTLD_LOCAL library, or using hidden visibility for the type,
> or linking against code produced by a compiler that violates the ABI).
>
> +1. Isn't the case of two different type_info objects for the same type a
> violation of ODR anyway
> (i.e. wouldn't this be something the UB sanitizer should check for)?


An ODR violation is one way you can get to this situation, yes. I don't
think it's reasonable to apply the ODR to hidden entities in separate DSOs
(whether they're hidden through visibility or RTLD_LOCAL) though, because
those mechanisms give more guarantees than the C++ standard provides. So I
don't think we can argue that this is /always/ an ODR violation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130816/e707a576/attachment.html>


More information about the cfe-commits mailing list