mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Add size checking on ArrayBuffer.prototype.transfer
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
d6aae0777f
commit
36f5fb5836
2 changed files with 5 additions and 1 deletions
|
|
@ -148,9 +148,13 @@ static Value builtinArrayBufferTransfer(ExecutionState& state, Value thisValue,
|
|||
newByteLength = argv[0].toIndex(state);
|
||||
}
|
||||
|
||||
obj->throwTypeErrorIfDetached(state);
|
||||
Optional<uint64_t> maxLength;
|
||||
if (obj->isResizableArrayBuffer()) {
|
||||
maxLength = obj->maxByteLength();
|
||||
if (newByteLength > maxLength.value()) {
|
||||
ErrorObject::throwBuiltinError(state, ErrorCode::RangeError, state.context()->staticStrings().ArrayBuffer.string(), true, state.context()->staticStrings().transfer.string(), ErrorObject::Messages::GlobalObject_FirstArgumentInvalidLength);
|
||||
}
|
||||
}
|
||||
ArrayBuffer* newValue = ArrayBufferObject::allocateArrayBuffer(state, state.context()->globalObject()->arrayBuffer(), newByteLength, maxLength);
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit e17c4680af0a133981ab19aa6ea0b67bd705f66c
|
||||
Subproject commit a381b0eb941323dbdd2ba4285ce0affaf92fef1c
|
||||
Loading…
Add table
Add a link
Reference in a new issue