This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix IFN_OBJECT_SIZE expansion (PR sanitizer/65081)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]