Re: Clang UndefinedBehaviorSanitize (Postgres14) Detected undefined-behavior

Ranier Vilela <ranier.vf@gmail.com>

From: Ranier Vilela <ranier.vf@gmail.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-08-27T17:11:11Z
Lists: pgsql-hackers
Em qui., 27 de ago. de 2020 às 13:57, Alvaro Herrera <
alvherre@2ndquadrant.com> escreveu:

> On 2020-Aug-27, Ranier Vilela wrote:
>
> > indexcmds.c (1162):
> > memcpy(part_oids, partdesc->oids, sizeof(Oid) * nparts);
>
> Looks legit, and at least per commit 13bba02271dc we do fix such things,
> even if it's useless in practice.
>
> Given that no buildfarm member has ever complained, this exercise seems
> pretty pointless.
>
See at:
https://postgrespro.com/list/thread-id/1870065
"NULL passed as an argument to memcmp() in parse_func.c
<https://postgrespro.com/list/id/BLU437-SMTP48A5B2099E7134AC6BE7C7F2A10@phx.gbl>
"

regards,
Ranier Vilela

Commits

  1. Avoid memcpy() with a NULL source pointer and count == 0

  2. Avoid calling memcpy() with a NULL source pointer and count == 0.