[PATCH] iconvdata: Fix invalid pointer arithmetic in ANSI_X3.110 module

Florian Weimer fweimer@redhat.com
Fri Nov 28 11:34:45 GMT 2025


* Paul Zimmermann:

>        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.

Thanks,
Florian



More information about the Libc-alpha mailing list