Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

new Float64Array(1024*1024*200) crashes #2280

Closed
kripken opened this issue Dec 6, 2011 · 3 comments
Closed

new Float64Array(1024*1024*200) crashes #2280

kripken opened this issue Dec 6, 2011 · 3 comments
Assignees

Comments

@kripken
Copy link

kripken commented Dec 6, 2011

On node 0.6.5, doing

new Float64Array(1024*1024*200)

leads to a segmentation fault. This is on 32-bit Linux. The array should take 1.6GB, which this machine has (but even if not, an error would be better than a segmentation fault). Creating smaller arrays works fine.

@ghost ghost assigned bnoordhuis Dec 6, 2011
@bnoordhuis
Copy link
Member

Confirmed.

@migounette
Copy link

This a V8 issue (v8_types_array.cc)

  length = args[0]->Uint32Value();
  // TODO(deanm): Handle integer overflow.
  v8::Handle<v8::Value> argv[1] = {
      v8::Integer::NewFromUnsigned(length * TBytes)};

  buffer = ArrayBuffer::GetTemplate()->
             GetFunction()->NewInstance(1, argv);

  void* buf = buffer->GetPointerFromInternalField(0); <== This is the exception because buffer._val == NULL

bnoordhuis can you help how I can submit a patch ? Do I need to submit a patch to v8 ?

@bnoordhuis
Copy link
Member

Fixed in 8c02f9b. V8 limits external arrays to 1024^3 bytes, node now throws a RangeError if you try to create a buffer or typed array that's larger than that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants