mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 07:48:12 +00:00
LibJS: Do not assume that IsArray means the object type is an Array
IsArray returns true if the object is an Array *or* if it is a ProxyObject whose target is an Array. Therefore, we cannot downcast to an Array based on IsArray. Luckily, we don't actually need an Array here; SerializeJSONArray only needs an Object. This was caught by UBSAN with vptr sanitation enabled.
This commit is contained in:
parent
98a6f962a0
commit
3efe611dbf
1 changed files with 1 additions and 1 deletions
|
@ -207,7 +207,7 @@ ThrowCompletionOr<String> JSONObject::serialize_json_property(VM& vm, StringifyS
|
|||
|
||||
// b. If isArray is true, return ? SerializeJSONArray(state, value).
|
||||
if (is_array)
|
||||
return serialize_json_array(vm, state, static_cast<Array&>(value.as_object()));
|
||||
return serialize_json_array(vm, state, value.as_object());
|
||||
|
||||
// c. Return ? SerializeJSONObject(state, value).
|
||||
return serialize_json_object(vm, state, value.as_object());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue