From b6c4e0c2fb514e5948369376ea4457393ba8a5e5 Mon Sep 17 00:00:00 2001 From: korbi Date: Sun, 21 Jan 2018 14:40:57 +0100 Subject: [PATCH] Fixes 'Offset is outside the bounds of the DataView' error --- lib/exif.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 +};