Skip to content

Commit f5f4a43

Browse files
committed
add NaN check for simple Sets
1 parent 22e34d8 commit f5f4a43

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/Runtime/Language/JavascriptConversion.inl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,15 @@ namespace Js {
292292
{
293293
return taggedInt;
294294
}
295-
296295
#if FLOATVAR
297-
return value;
296+
if (typeId == TypeIds_Number)
297+
{
298+
// NaN could have sign bit set, but that isn't observable so canonicalize to positive NaN
299+
double numberValue = JavascriptNumber::GetValue(value);
300+
return JavascriptNumber::IsNan(numberValue)
301+
? JavascriptNumber::ToVar(JavascriptNumber::NaN)
302+
: value;
303+
}
298304
#else
299305
return nullptr;
300306
#endif

0 commit comments

Comments
 (0)