json: turn off ubsan for json_variant_has_type()

Fixes: #15907
This commit is contained in:
Lennart Poettering
2020-05-26 09:01:26 +02:00
parent 6028d766d1
commit 8e2fa6e223
2 changed files with 12 additions and 1 deletions
+4 -1
View File
@@ -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;