]> git.ipfire.org Git - thirdparty/shadow.git/commit
tests/unit/test_xasprintf.c: Fix use of volatile pointer
authorAlejandro Colomar <alx@kernel.org>
Fri, 28 Jun 2024 11:57:35 +0000 (13:57 +0200)
committerAlejandro Colomar <alx@kernel.org>
Fri, 28 Jun 2024 21:35:50 +0000 (23:35 +0200)
commitbabbfd2ffb78ff26c5ef194fdd3f38be9c82b463
treea1c3d183990b2c26b2563742f67c25c170d46089
parentd5616f4c4e8ee2581807386d6e93fc1c69e7c178
tests/unit/test_xasprintf.c: Fix use of volatile pointer

volatile needs to be casted away behind a [[gnu::noipa]] function, to
make that invisible to the compiler.  Otherwise, the compiler can see
that it is being discarded, and is free to abuse Undefined Behavior.

Closes: <https://github.com/shadow-maint/shadow/issues/1028>
Reported-by: Chris Hofstaedtler <zeha@debian.org>
Tested-by: Chris Hofstaedtler <zeha@debian.org>
Reviewed-by: Chris Hofstaedtler <zeha@debian.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Cherry-picked-from: 6e57238bf915 ("tests/unit/test_xasprintf.c: Fix use of volatile pointer")
Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
tests/unit/test_xasprintf.c