Re: pgsql: Ensure that length argument of memcmp() isn't seen as negative.

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Ensure that length argument of memcmp() isn't seen as negative.
Date: 2022-02-15 22:46:25
Message-ID: 20220215224625.poqi7mrwtkhcsdpv@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Hi,

On 2022-02-15 22:28:23 +0000, Tom Lane wrote:
> Ensure that length argument of memcmp() isn't seen as negative.
>
> I think this will shut up a weird warning from buildfarm member
> serinus. Perhaps it'd be better to change tsCompareString's
> length arguments to unsigned, but that seems more invasive
> than is justified.

Just FYI, I'd reported this to gcc some time last year
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100442
and then forgot about it.

They're not wrong there is the possibility of exceeding the bounds, but the
error message still is quite confusing.

Greetings,

Andres Freund

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2022-02-15 23:17:17 pgsql: Update "don't truncate with failsafe" rationale.
Previous Message Tom Lane 2022-02-15 22:44:40 Re: pgsql: Track LLVM 15 changes.