[tz] Minor (unimportant really) technical UB bug in strftime() ?
Paul Eggert
eggert at cs.ucla.edu
Tue Nov 8 23:39:50 UTC 2022
On 11/8/22 06:28, Clive D.W. Feather via tz wrote:
> You could replace the assignment by a memcpy. Assignment via unsigned
> chars (which is what memcpy does) are exempt from the undefined behaviour.
As I understand it, that exemption is for using memcpy to copy a trap
representation. There's no similar exemption for using memcpy to copy
uninitialized data; for example, the following function has undefined
behavior:
int y;
void f(void) { int x; memcpy(&y, &x, sizeof y); }
If I'm right, we can't get by simply by replacing the assignment with
memcpy.
More information about the tz
mailing list