mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
json: avoid converting random string to floats
Only allow the json float characters when converting to float. This avoids NAN, INF, 0xffe4 etc to be seen as a json float.
This commit is contained in:
parent
bdfde2fdf0
commit
cbbc4baa3f
2 changed files with 3 additions and 1 deletions
|
|
@ -86,7 +86,7 @@ static void expect_float(struct spa_json *it, float val)
|
|||
{
|
||||
const char *value;
|
||||
int len;
|
||||
float f;
|
||||
float f = 0.0f;
|
||||
pwtest_int_gt((len = spa_json_next(it, &value)), 0);
|
||||
check_type(TYPE_FLOAT, value, len);
|
||||
pwtest_int_gt(spa_json_parse_float(value, len, &f), 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue