@@ -1058,8 +1058,7 @@ static int json_object_double_to_json_string_format(struct json_object *jso, str
1058
1058
format_drops_decimals = 1 ;
1059
1059
1060
1060
looks_numeric = /* Looks like *some* kind of number */
1061
- is_plain_digit (buf [0 ]) ||
1062
- (size > 1 && buf [0 ] == '-' && is_plain_digit (buf [1 ]));
1061
+ is_plain_digit (buf [0 ]) || (size > 1 && buf [0 ] == '-' && is_plain_digit (buf [1 ]));
1063
1062
1064
1063
if (size < (int )sizeof (buf ) - 2 && looks_numeric && !p && /* Has no decimal point */
1065
1064
strchr (buf , 'e' ) == NULL && /* Not scientific notation */
@@ -1283,7 +1282,8 @@ static struct json_object *_json_object_new_string(const char *s, const size_t l
1283
1282
return NULL ;
1284
1283
jso -> len = len ;
1285
1284
memcpy (jso -> c_string .idata , s , len );
1286
- jso -> c_string .idata [len ] = '\0' ;
1285
+ // Cast below needed for Clang UB sanitizer
1286
+ ((char * )jso -> c_string .idata )[len ] = '\0' ;
1287
1287
return & jso -> base ;
1288
1288
}
1289
1289
@@ -1733,8 +1733,8 @@ static int json_object_deep_copy_recursive(struct json_object *src, struct json_
1733
1733
/* This handles the `json_type_null` case */
1734
1734
if (!iter .val )
1735
1735
jso = NULL ;
1736
- else if (json_object_deep_copy_recursive (iter .val , src , iter .key , UINT_MAX , & jso ,
1737
- shallow_copy ) < 0 )
1736
+ else if (json_object_deep_copy_recursive (iter .val , src , iter .key , UINT_MAX ,
1737
+ & jso , shallow_copy ) < 0 )
1738
1738
{
1739
1739
json_object_put (jso );
1740
1740
return -1 ;
0 commit comments