| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index c09fb1d49904585d0eb6f673d350de65c8c38abb..b8d9737cd17bbb6c0ba8de676f9566bdd920eda3 100644
|
| --- a/src/runtime.cc
|
| +++ b/src/runtime.cc
|
| @@ -947,12 +947,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_TypedArrayInitializeFromArrayLike) {
|
|
|
| Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer();
|
| size_t length = NumberToSize(isolate, *length_obj);
|
| - size_t byte_length = length * element_size;
|
| - if (byte_length < length) { // Overflow
|
| + if (length > (kMaxInt / element_size)) {
|
| return isolate->Throw(*isolate->factory()->
|
| NewRangeError("invalid_array_buffer_length",
|
| HandleVector<Object>(NULL, 0)));
|
| }
|
| + size_t byte_length = length * element_size;
|
|
|
| // We assume that the caller of this function will initialize holder
|
| // with the loop
|
|
|