Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bl

Package Overview
Dependencies
Maintainers
2
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bl - npm Package Compare versions

Comparing version 4.0.2 to 4.0.3

11

BufferList.js

@@ -137,8 +137,9 @@ 'use strict'

this._bufs[i].copy(dst, bufoff, start)
bufoff += l
} else {
this._bufs[i].copy(dst, bufoff, start, start + bytes)
bufoff += l
break
}
bufoff += l
bytes -= l

@@ -151,2 +152,5 @@

// safeguard so that we don't return uninitialized memory
if (dst.length > bufoff) return dst.slice(0, bufoff)
return dst

@@ -193,2 +197,7 @@ }

BufferList.prototype.consume = function consume (bytes) {
// first, normalize the argument, in accordance with how Buffer does it
bytes = Math.trunc(bytes)
// do nothing if not a positive number
if (Number.isNaN(bytes) || bytes <= 0) return this
while (this._bufs.length) {

@@ -195,0 +204,0 @@ if (bytes >= this._bufs[0].length) {

3

package.json
{
"name": "bl",
"version": "4.0.2",
"version": "4.0.3",
"description": "Buffer List: collect buffers and access with a standard readable Buffer interface, streamable too!",
"license": "MIT",
"main": "bl.js",

@@ -6,0 +7,0 @@ "scripts": {

@@ -466,2 +466,18 @@ 'use strict'

tape('uninitialized memory', function (t) {
const secret = crypto.randomBytes(256)
for (let i = 0; i < 1e6; i++) {
const clone = Buffer.from(secret)
const bl = new BufferList()
bl.append(Buffer.from('a'))
bl.consume(-1024)
const buf = bl.slice(1)
if (buf.indexOf(clone) !== -1) {
t.fail(`Match (at ${i})`)
break
}
}
t.end()
})
!process.browser && tape('test stream', function (t) {

@@ -468,0 +484,0 @@ const random = crypto.randomBytes(65534)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc