summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-05-25 18:21:08 +0200
committerLennart Poettering <lennart@poettering.net>2020-05-26 09:01:26 +0200
commit8e2fa6e2236ec81c86612f75103f36ba699193c8 (patch)
tree3288fc3db8ed631a4254643c20990a1523e3d971 /src/shared
parentmacro: introduce DISABLE_WARNING_TYPE_LIMITS and make use of it everywhere (diff)
downloadsystemd-8e2fa6e2236ec81c86612f75103f36ba699193c8.tar.xz
systemd-8e2fa6e2236ec81c86612f75103f36ba699193c8.zip
json: turn off ubsan for json_variant_has_type()
Fixes: #15907
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/json.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/shared/json.c b/src/shared/json.c
index a3ad5b996a..27a3a518fe 100644
--- a/src/shared/json.c
+++ b/src/shared/json.c
@@ -1093,9 +1093,12 @@ JsonVariantType json_variant_type(JsonVariant *v) {
return v->type;
}
-bool json_variant_has_type(JsonVariant *v, JsonVariantType type) {
+_function_no_sanitize_float_cast_overflow_ bool json_variant_has_type(JsonVariant *v, JsonVariantType type) {
JsonVariantType rt;
+ /* Note: we turn off ubsan float cast overflo detection for this function, since it would complain
+ * about our float casts but we do them explicitly to detect conversion errors. */
+
v = json_variant_dereference(v);
if (!v)
return false;