diff options
author | Rich Trott <rtrott@gmail.com> | 2018-01-02 16:10:57 -0800 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-01-05 12:40:26 +0100 |
commit | 9fea7eae9a48c6c2e8fb75204a4e5c60e700a3e2 (patch) | |
tree | ad364509fe82fb00bab194b68ac7f54d2c58a102 /lib | |
parent | 94d64877ff2b9d5fcfb40d24358337a95c333f66 (diff) | |
download | android-node-v8-9fea7eae9a48c6c2e8fb75204a4e5c60e700a3e2.tar.gz android-node-v8-9fea7eae9a48c6c2e8fb75204a4e5c60e700a3e2.tar.bz2 android-node-v8-9fea7eae9a48c6c2e8fb75204a4e5c60e700a3e2.zip |
buffer: check byteLength in readUInt(B|L)E
PR-URL: https://github.com/nodejs/node/pull/11146
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/buffer.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/buffer.js b/lib/buffer.js index cd08453c24..03f0cb3377 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -1040,8 +1040,10 @@ Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) { offset = offset >>> 0; byteLength = byteLength >>> 0; - if (!noAssert) + if (!noAssert) { + checkByteLength(byteLength); checkOffset(offset, byteLength, this.length); + } var val = this[offset]; var mul = 1; @@ -1057,8 +1059,10 @@ Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) { offset = offset >>> 0; byteLength = byteLength >>> 0; - if (!noAssert) + if (!noAssert) { + checkByteLength(byteLength); checkOffset(offset, byteLength, this.length); + } var val = this[offset + --byteLength]; var mul = 1; |