diff --git a/lib/exif.js b/lib/exif.js index eb443de..114a8f1 100644 --- a/lib/exif.js +++ b/lib/exif.js @@ -83,6 +83,10 @@ function readExifTag(tiffMarker, stream) { } function readIFDSection(tiffMarker, stream, iterator) { + // make sure we can read nextUint16 byte + if (stream.remainingLength() < 2){ + return; + } var numberOfEntries = stream.nextUInt16(), tag, i; for(i = 0; i < numberOfEntries; ++i) { tag = readExifTag(tiffMarker, stream); @@ -162,4 +166,4 @@ module.exports = { } return true; } -}; \ No newline at end of file +};