diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-01-26 11:55:16 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-01-26 11:58:08 +0100 |
commit | ddc5aa7cd3121300f2ba6e68cb038258a616d4e4 (patch) | |
tree | 63585f32e5334f6e7ea9f4693e94d740744e5482 /types.c | |
parent | 58e1da9b7dd69af0f32fb2a70c1808dce8c51733 (diff) |
vm: fix NaN strict equality tests
A performance shortcut in `ucv_is_equal()` incorrectly led to `NaN === NaN`
being true. Fix the issue by only comparing pointers when the involved
types are not doubles.
Due to fixing `NaN !== NaN`, the `uniq()` function now requires a special
case to treat multiple NaNs equal for the sake of generating an array of
unique values.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'types.c')
-rw-r--r-- | types.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1764,7 +1764,7 @@ ucv_is_equal(uc_value_t *uv1, uc_value_t *uv2) if (t1 != t2) return false; - if (uv1 == uv2) + if (t1 != UC_DOUBLE && uv1 == uv2) return true; switch (t1) { |