On Wed, Feb 18, 2015 at 10:15:03AM +0100, Marek Polacek wrote:
> We're lacking the POINTER_DIFF_EXPR, which means that ptr - 1 is in fact
> ptr + very_big_number.  This can result in bogus run-time error when the
> objsz checking is turned on.  Jakub suggested to not to issue the error
> if (ptr > ptr + offset) is true.  So this patch attemps to do that, along
> with some optimizations for the common case.
> 
> Bootstrap-ubsan passed, bootstrapped/regtested on x86_64-linux, ok for trunk?
> 
> 2015-02-17  Marek Polacek  <pola...@redhat.com>
> 
>       PR sanitizer/65081
>       * ubsan.c (OBJSZ_MAX_OFFSET): Define.
>       (ubsan_expand_objsize_ifn): Don't emit run-time check if the offset
>       is in range [-16K, -1].  Don't issue run-time error if
>       (ptr > ptr + offset).
> 
>       * c-c++-common/ubsan/pr65081.c: New test.

Ok, thanks.

        Jakub

Reply via email to