New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

image-dimensions-stream

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

image-dimensions-stream - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

2

package.json
{
"name": "image-dimensions-stream",
"version": "0.0.6",
"version": "0.0.7",
"description": "Get image dimensions from stream",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -12,2 +12,3 @@ const BaseType = require('../BaseType');

const requiredBufDimsSize = 9; // 7 offset + 2 bytes to align Int16
const bytesToGetBlockLen = 3;

@@ -25,6 +26,2 @@ module.exports = class JpgType extends BaseType {

super(...args);
this._meta = {
lastMarkers: [],
};
}

@@ -40,9 +37,9 @@

if (markerStartIdx === -1) break;
if (curBuf.length === 1 || markerStartIdx === curBuf.length - 1) {
return this.keep(curBuf.slice(curBuf.length - 1));
}
const currentMarker = curBuf[markerStartIdx + 1];
// skip reserved values

@@ -56,3 +53,3 @@ if (currentMarker === 0xFF) {

}
// skip entropy-coded data and other empty block markers

@@ -67,9 +64,2 @@ if (currentMarker === 0x00 || (currentMarker >= 0xD0 && currentMarker <= 0xD9)) {

let bytesToGetBlockLen = 3;
// define restart interval marker has 4 bytes block length
if (currentMarker === 0xDD) {
bytesToGetBlockLen += 2;
}
// check that buffer is big enough to read block length

@@ -80,15 +70,4 @@ if (curBuf.length - 1 < markerStartIdx + bytesToGetBlockLen) {

let blockLength = null;
if (currentMarker === 0xDD) {
blockLength = curBuf.readUInt32BE(markerStartIdx + 2);
} else {
blockLength = curBuf.readUInt16BE(markerStartIdx + 2);
}
const blockLength = curBuf.readUInt16BE(markerStartIdx + 2);
// keep last 10 markers to skip thumbnails
if (this._meta.lastMarkers.length === 10) {
this._meta.lastMarkers.splice(0, 1);
}
if (types.some(markerBuf => {

@@ -109,7 +88,5 @@ return currentMarker === markerBuf;

}
this._meta.lastMarkers.push({ marker: `0x${currentMarker.toString(16).toUpperCase()}`, size: blockLength });
// skip current marker block
const blockLengthIdx = markerStartIdx + blockLength + 2;

@@ -116,0 +93,0 @@ curFirstByteOffset += blockLengthIdx;

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