Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions lib/Runtime/Library/TypedArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,6 @@ namespace Js
Var TypedArrayBase::CreateNewInstance(Arguments& args, ScriptContext* scriptContext, uint32 elementSize, PFNCreateTypedArray pfnCreateTypedArray)
{
uint32 byteLength = 0;
uint32 newByteLength = 0;
int32 offset = 0;
int32 mappedLength = -1;
uint32 elementCount = 0;
Expand Down Expand Up @@ -509,16 +508,7 @@ namespace Js

if (args.Info.Count > 3 && !JavascriptOperators::IsUndefinedObject(args[3]))
{
mappedLength = ArrayBuffer::ToIndex(args[3], JSERR_InvalidTypedArrayLength, scriptContext, ArrayBuffer::MaxArrayBufferLength / elementSize, false);
newByteLength = mappedLength * elementSize;

if (offset + newByteLength > byteLength)
{
JavascriptError::ThrowRangeError(
scriptContext, JSERR_InvalidTypedArrayLength);
}

byteLength = newByteLength;
mappedLength = ArrayBuffer::ToIndex(args[3], JSERR_InvalidTypedArrayLength, scriptContext, (byteLength - offset) / elementSize, false);
}
else
{
Expand Down