Skip to content

Canonicalize NaNs before storing in JS::Value

Philip Chimento requested to merge ptomato/gjs:591-canonicalize-nans into master

Everywhere that we get a floating-point value from C that might be a NaN, we must call JS::CanonicalizeNaN() on it before trying to store it in a JS::Value.

There is only one NaN representation in SpiderMonkey because the rest of the bit-space occupied by NaNs is used to store the tag, pointers, etc., so trying to create a NumberValue with a non-canonical NaN will most likely crash due to an invalid pointer.

This is important in particular for argument and GValue marshalling. For completeness, we do it for doubles returned from Cairo as well, though that's probably not necessary.

Closes: #591 (closed)

Merge request reports