summaryrefslogtreecommitdiffhomepage
path: root/types.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-01-26 11:55:16 +0100
committerJo-Philipp Wich <jo@mein.io>2022-01-26 11:58:08 +0100
commitddc5aa7cd3121300f2ba6e68cb038258a616d4e4 (patch)
tree63585f32e5334f6e7ea9f4693e94d740744e5482 /types.c
parent58e1da9b7dd69af0f32fb2a70c1808dce8c51733 (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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/types.c b/types.c
index 5ea1180..dac0efb 100644
--- a/types.c
+++ b/types.c
@@ -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) {