This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix IFN_OBJECT_SIZE expansion (PR sanitizer/65081)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 18 Feb 2015 10:24:19 +0100
- Subject: Re: [PATCH] Fix IFN_OBJECT_SIZE expansion (PR sanitizer/65081)
- Authentication-results: sourceware.org; auth=none
- References: <20150218091502 dot GW23138 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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 <firstname.lastname@example.org>
> 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.