nodeca / probe-image-size

Get image size without full download. Supported image types: JPG, GIF, PNG, WebP, BMP, TIFF, SVG, PSD, ICO.
MIT License
988 stars 77 forks source link

fix edge case when passing zero value to skipBytes #5

Closed winglian closed 8 years ago

winglian commented 8 years ago

If count === 0, the stream-parser will throw an error. https://github.com/TooTallNate/node-stream-parser/blob/master/index.js#L117

puzrin commented 8 years ago
  1. Is it possible to add test for this fix?
  2. It seems, other formats also can be affected by this bug
puzrin commented 8 years ago

Created issue in node-stream-parser https://github.com/TooTallNate/node-stream-parser/issues/6. May be author will agree to change upstream

winglian commented 8 years ago

@puzrin I have a TIFF file that's 4MB that exhibits the bug when I was trying to parse it, but it probably isn't a good idea to drop a file that large into the repo as a fixture. I checked the other formats, JPEG already had a workaround and none of the others had a dynamic skip that would lead to that condition.

puzrin commented 8 years ago

Please. squash all to single commit

/cc @rlidwka take a look please

puzrin commented 8 years ago

Published, with more fixes of the same type of bugs + tests.