[PATCH] iconvdata: Fix invalid pointer arithmetic in ANSI_X3.110 module
Paul Zimmermann
Paul.Zimmermann@inria.fr
Fri Nov 28 12:42:52 GMT 2025
Hi Florian,
> > just curious: as long as we don't access the array though array[inptr+1],
> > it is not a problem to just compute inptr+1, no?
>
> >> - if (inptr + 1 >= inend) \
> >> + if (inend - inptr <= 1) \
>
> It's still invalid C.
>
> Technically, inptr could be the last byte in the address space, that is,
> inptr == (const uint8_t *) -1, and then the original comparison would
> give the wrong result.
I understand. Then it is more an overflow issue than "invalid pointer
arithmetic".
Paul
More information about the Libc-alpha
mailing list