Re: Clang UndefinedBehaviorSanitize (Postgres14) Detected undefined-behavior
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Ranier Vilela <ranier.vf@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Peter Geoghegan <pg@bowt.ie>, Noah Misch <noah@leadboat.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-08-31T17:00:50Z
Lists: pgsql-hackers
On 2020-Aug-31, Ranier Vilela wrote: > More troubles with undefined-behavior. > > This type of code can leaves overflow: > var = (cast) (expression); > diff = (int32) (id1 - id2); > > See: > diff64 = ((long int) d1 - (long int) d2); > diff64=-4294901760 Did you compile this with gcc -fwrapv? -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Avoid memcpy() with a NULL source pointer and count == 0
- f0ff52f25cb9 12.6 landed
- 677f74e5bb83 14.0 landed
- 5a1d1b9540a4 13.2 landed
- 49aaabdf8d0b 11.11 landed
-
Avoid calling memcpy() with a NULL source pointer and count == 0.
- 13bba02271dc 9.6.0 cited