mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-24 17:10:08 +01:00
If __x is signed and its value is the minimum allowed for the type,
(__x - 1) causes a signed overflow, which has an undefined
behavior. Compiling with -fsanitize=undefined produces the warnings:
test-general.c:4499:619: runtime error: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
test-general.c:4506:681: runtime error: signed integer overflow: -2147483648 - 1 cannot be represented in type 'TEST_IS_POWER_OF_TWP_ENUM_SIGNED'
test-general.c:4501:619: runtime error: signed integer overflow: -9223372036854775808 - 1 cannot be represented in type 'long int'
test-general.c:4509:691: runtime error: signed integer overflow: -9223372036854775808 - 1 cannot be represented in type 'TEST_IS_POWER_OF_TWP_ENUM_UNSIGNED_64'
Change the order of expressions to avoid this.
Fixes:
|
||
|---|---|---|
| .. | ||
| gsystem-local-alloc.h | ||
| Makefile.am | ||
| nm-dbus-compat.h | ||
| nm-default.h | ||
| nm-glib.h | ||
| nm-macros-internal.h | ||
| nm-test-utils.h | ||
| nm-version-macros.h.in | ||