summaryrefslogtreecommitdiff
path: root/src/node_zlib.cc
diff options
context:
space:
mode:
authorTimothy J Fontaine <tjfontaine@gmail.com>2014-02-05 08:50:40 -0800
committerTimothy J Fontaine <tjfontaine@gmail.com>2014-02-08 15:31:27 -0800
commit5c832e44c3c61ad41506df0d283901aba6aea187 (patch)
tree08d45b505d04bdfd52bb38e4f52f62f6c5982cd2 /src/node_zlib.cc
parent2e8bb57fe37fd75323d3e3290be7264df97fe4dc (diff)
downloadandroid-node-v8-5c832e44c3c61ad41506df0d283901aba6aea187.tar.gz
android-node-v8-5c832e44c3c61ad41506df0d283901aba6aea187.tar.bz2
android-node-v8-5c832e44c3c61ad41506df0d283901aba6aea187.zip
src: refactor buffer bounds checking
Consolidate buffer bounds checking logic into Buffer namespace and use it consistently throughout the source.
Diffstat (limited to 'src/node_zlib.cc')
-rw-r--r--src/node_zlib.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/node_zlib.cc b/src/node_zlib.cc
index 9acbfcb75a..d522676284 100644
--- a/src/node_zlib.cc
+++ b/src/node_zlib.cc
@@ -155,7 +155,7 @@ class ZCtx : public ObjectWrap {
in_off = args[2]->Uint32Value();
in_len = args[3]->Uint32Value();
- assert(in_off + in_len <= Buffer::Length(in_buf));
+ assert(Buffer::IsWithinBounds(in_off, in_len, Buffer::Length(in_buf)));
in = reinterpret_cast<Bytef *>(Buffer::Data(in_buf) + in_off);
}
@@ -163,7 +163,7 @@ class ZCtx : public ObjectWrap {
Local<Object> out_buf = args[4]->ToObject();
out_off = args[5]->Uint32Value();
out_len = args[6]->Uint32Value();
- assert(out_off + out_len <= Buffer::Length(out_buf));
+ assert(Buffer::IsWithinBounds(out_off, out_len, Buffer::Length(out_buf)));
out = reinterpret_cast<Bytef *>(Buffer::Data(out_buf) + out_off);
// build up the work request