[PATCH][gdb] fix unsigned overflow in charset.c

Paul Koning paulkoning@comcast.net
Tue Oct 9 17:40:00 GMT 2018



> On Oct 9, 2018, at 1:31 PM, Pedro Alves <palves@redhat.com> wrote:
> 
> On 10/09/2018 06:19 PM, Paul Koning wrote:
>> This fixed an overflow in pointer arithmetic that crashes GDB on Mac OS.
> 
> _unsigned_ overflow?  That isn't undefined.  Do we really want to trap
> those?  I don't think GCC's version does that.
> 
> From: 
>  https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#silencing-unsigned-integer-overflow
> seems like there's a way to disable it.
> 
> Thanks,
> Pedro Alves

You're right, it was an LLVM build.  I know unsigned overflow is well defined with integers; is that true for pointers?

Given that GDB triggers this issue, should the GDB build do that LLVM workaround if LLVM is used to build it?  

But it seems simpler to use the proposed patch; clearly the intent is to back up a pointer by -(space_left) and doing that operation on a signed type seems like a logical thing to do, it makes the intended meaning clear.

	paul



More information about the Gdb-patches mailing list