mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-02 22:55:23 +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:
committed by
Andreas Kling
parent
98a6f962a0
commit
3efe611dbf
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user