smalloc: fix assertion fails/segfault
authorTrevor Norris <trev.norris@gmail.com>
Fri, 2 Aug 2013 19:52:43 +0000 (12:52 -0700)
committerTrevor Norris <trev.norris@gmail.com>
Fri, 2 Aug 2013 19:52:43 +0000 (12:52 -0700)
commitda07709c74b7a695fa2155718a9d9b193ffd169a
tree85302cf9ab31bd0763c4d578e81472cf068fe21e
parent3158ffb6ef153c0e76f4a6b5b98e91a8315c197c
smalloc: fix assertion fails/segfault

* Numeric values passed to alloc were converted to int32, not uint32
  before the range check, which allows wrap around on ToUint32. This
  would cause massive malloc calls and v8 fatal errors.
* dispose would not check if value was an Object, causing segfault if a
  Primitive was passed.
* kMaxLength was not enumerable.
lib/smalloc.js
test/simple/test-smalloc.js