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

probe-image-size

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

probe-image-size - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

6

CHANGELOG.md

@@ -0,1 +1,7 @@

1.0.6 / 2016-04-13
------------------
- Fixed parser crashes on zero length data & offsets.
1.0.5 / 2015-12-15

@@ -2,0 +8,0 @@ ------------------

15

lib/parsers/jpeg.js

@@ -55,3 +55,10 @@ 'use strict';

if ((0xC0 <= code && code <= 0xCF) &&
if (length <= 0) {
// e.g. empty comment
getJpegSize(parser, callback);
return;
}
if (length >= 5 &&
(0xC0 <= code && code <= 0xCF) &&
code !== 0xC4 && code !== 0xC8 && code !== 0xCC) {

@@ -71,8 +78,2 @@

if (length <= 0) {
// e.g. empty comment
getJpegSize(parser, callback);
return;
}
parser._skipBytes(length, function () {

@@ -79,0 +80,0 @@ getJpegSize(parser, callback);

@@ -22,3 +22,2 @@ 'use strict';

module.exports = function (input, _callback) {

@@ -55,4 +54,13 @@ var callback = once(_callback);

function safeSkip(parser, count, callback) {
if (count === 0) { // parser._skipBytes throws error if count === 0
callback();
return;
}
parser._skipBytes(count, callback);
}
// skip until IFD
parser._skipBytes(count, function () {
safeSkip(parser, count, function () {
// read number of IFD entries

@@ -62,2 +70,8 @@ parser._bytes(2, function (data) {

if (count <= 0) {
parser._skipBytes(Infinity);
callback();
return;
}
// read all IFD entries

@@ -64,0 +78,0 @@ parser._bytes(count, function (data) {

{
"name": "probe-image-size",
"version": "1.0.5",
"version": "1.0.6",
"description": "Get image size without full download (JPG, GIF, PNG, WebP, BMP, TIFF, PSD)",

@@ -32,4 +32,4 @@ "keywords": [

"devDependencies": {
"eslint": "0.24.0",
"eslint-plugin-nodeca": "^1.0.3",
"eslint": "2.7.0",
"from2": "^2.1",
"istanbul": "^0.4.1",

@@ -36,0 +36,0 @@ "mocha": "^2.2.5"

@@ -41,3 +41,3 @@ probe-image-size

probe(input, function (err, result) {
console.log(result); // => { width: xx, height: yy, type: 'jpg', mime: 'image/jpg' }
console.log(result); // => { width: xx, height: yy, type: 'jpg', mime: 'image/jpeg' }

@@ -44,0 +44,0 @@ // terminate input, depends on stream type,

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