diff options
author | Trevor Norris <trev.norris@gmail.com> | 2015-06-17 11:34:12 -0600 |
---|---|---|
committer | Rod Vagg <rod@vagg.org> | 2015-08-04 11:56:12 -0700 |
commit | b625ab4242f55b7769e990ea1386d77ee224f273 (patch) | |
tree | 0c3a130eec1366e0186a5bbbc650d56ee1d6871b /test | |
parent | 423d8944ce58bc8c3f90d2827339a4dea10ab96e (diff) | |
download | android-node-v8-b625ab4242f55b7769e990ea1386d77ee224f273.tar.gz android-node-v8-b625ab4242f55b7769e990ea1386d77ee224f273.tar.bz2 android-node-v8-b625ab4242f55b7769e990ea1386d77ee224f273.zip |
buffer: fix usage of kMaxLength
Starting in V8 v4.3 the maximum array index of a typed array is the same
as the largest Smi supported on a given architecture. To compensate for
these differences export kMaxLength from the buffer module with the
correct size for the given architecture.
PR-URL: https://github.com/nodejs/io.js/pull/2003
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-regress-GH-io-1811.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/parallel/test-regress-GH-io-1811.js b/test/parallel/test-regress-GH-io-1811.js index 2ef8ff8c09..b7c99a17a5 100644 --- a/test/parallel/test-regress-GH-io-1811.js +++ b/test/parallel/test-regress-GH-io-1811.js @@ -2,12 +2,13 @@ const assert = require('assert'); -// Change kMaxLength for zlib to trigger the error -// without having to allocate 1GB of buffers -const smalloc = process.binding('smalloc'); -smalloc.kMaxLength = 128; +// Change kMaxLength for zlib to trigger the error without having to allocate +// large Buffers. +const buffer = require('buffer'); +const oldkMaxLength = buffer.kMaxLength; +buffer.kMaxLength = 128; const zlib = require('zlib'); -smalloc.kMaxLength = 0x3fffffff; +buffer.kMaxLength = oldkMaxLength; const encoded = new Buffer('H4sIAAAAAAAAA0tMHFgAAIw2K/GAAAAA', 'base64'); |