diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2012-02-01 22:37:26 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2012-02-02 19:14:06 +0100 |
commit | 7e40c7ddc93f9260a3f4b1683ff6f86aff91e761 (patch) | |
tree | 9d91e441f33f5f38dab506a4f9338180b98a0e7e /src/node_buffer.cc | |
parent | f101f7c9babb31f077c78b52de7cc45ad687f57e (diff) | |
download | android-node-v8-7e40c7ddc93f9260a3f4b1683ff6f86aff91e761.tar.gz android-node-v8-7e40c7ddc93f9260a3f4b1683ff6f86aff91e761.tar.bz2 android-node-v8-7e40c7ddc93f9260a3f4b1683ff6f86aff91e761.zip |
buffers: fix intermittent out of bounds error
The base64 decoder would intermittently throw an out-of-bounds exception when
the buffer in `buf.write('', 'base64')` was a zero-sized buffer located at the
end of the slab.
Fixes #2657.
Diffstat (limited to 'src/node_buffer.cc')
-rw-r--r-- | src/node_buffer.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 34ae5e5cc0..51e5423e5e 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -597,7 +597,7 @@ Handle<Value> Buffer::Base64Write(const Arguments &args) { : args[2]->Uint32Value(); max_length = MIN(s.length(), MIN(buffer->length_ - offset, max_length)); - if (offset >= buffer->length_) { + if (max_length && offset >= buffer->length_) { return ThrowException(Exception::TypeError(String::New( "Offset is out of bounds"))); } |