Socket
Socket
Sign inDemoInstall

bl

Package Overview
Dependencies
Maintainers
2
Versions
63
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 3.0.0 to 3.0.1

11

bl.js

@@ -188,8 +188,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

@@ -201,2 +202,5 @@

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

@@ -237,2 +241,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) {

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

2

package.json
{
"name": "bl",
"version": "3.0.0",
"version": "3.0.1",
"description": "Buffer List: collect buffers and access with a standard readable Buffer interface, streamable too!",

@@ -5,0 +5,0 @@ "main": "bl.js",

@@ -434,2 +434,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) {

@@ -436,0 +452,0 @@ var random = crypto.randomBytes(65534)

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