From 62027432318df2de77049a0077cc766f2343462e Mon Sep 17 00:00:00 2001 From: lhagan Date: Tue, 11 Jun 2013 21:10:12 -0700 Subject: [PATCH] handle invalid ifd --- lib/exif/ExifImage.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/exif/ExifImage.js b/lib/exif/ExifImage.js index 636a6be..f3e5573 100644 --- a/lib/exif/ExifImage.js +++ b/lib/exif/ExifImage.js @@ -187,6 +187,9 @@ ExifImage.prototype.extractExifData = function (data, start, length) { // Each IFD entry consists of 12 bytes which we loop through and extract // the data from for (var i = 0; i < numberOfEntries; i++) { + if (numberOfEntries > 1000) { + break; + } var exifEntry = self.extractExifEntry(data, (ifdOffset + 2 + (i * 12)), tiffOffset, this.isBigEndian, ExifImage.TAGS.exif); if (exifEntry && exifEntry.tagName !== null) this.exifData.exif[exifEntry.tagName] = exifEntry.value; }