mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Refuse to serialize NaN values.
NaN values could not be serialised safely because of the multiple possible NaN numbers. Since NaN values are usually the result of bugs or dangerous code, it seems simpler to refuse to serialise them. (D3205 was a safe-serialization alternative, should the need arise). Fixes #1879 Differential Revision: https://code.wildfiregames.com/D3729 This was SVN commit r25151.
This commit is contained in:
@@ -770,7 +770,10 @@ public:
|
||||
|
||||
void test_script_nonfinite()
|
||||
{
|
||||
helper_script_roundtrip("nonfinite", "[0, Infinity, -Infinity, NaN, -1/Infinity]", "[0, Infinity, -Infinity, NaN, -0]");
|
||||
helper_script_roundtrip("nonfinite", "[0, Infinity, -Infinity, -1/Infinity]", "[0, Infinity, -Infinity, -0]");
|
||||
|
||||
TestLogger logger;
|
||||
TS_ASSERT_THROWS(helper_script_roundtrip("nan", "[NaN]", "[NaN]"), const PSERROR_Serialize_InvalidScriptValue&);
|
||||
}
|
||||
|
||||
void test_script_property_order()
|
||||
|
||||
Reference in New Issue
Block a user