bwindels / exif-parser

A javascript library to extract EXIF metadata from JPEG images, in node and in the browser.
MIT License
218 stars 53 forks source link

Reading EXIF information throws exception #29

Open cajus opened 6 years ago

cajus commented 6 years ago

Trying to examine this image (yes, it is just white) runs into

RangeError [ERR_INDEX_OUT_OF_RANGE]: Index out of range
    at checkOffset (buffer.js:1024:11)
    at Buffer.readUInt16LE (buffer.js:1072:5)
    at BufferStream.nextUInt16 (node_modules/exif-parser/lib/bufferstream.js:24:84)
    at readIFDSection (node_modules/exif-parser/lib/exif.js:86:31)
    at Object.parseTags (node_modules/exif-parser/lib/exif.js:140:4)
    at node_modules/exif-parser/lib/parser.js:143:29
    at Object.parseSections (node_modules/exif-parser/lib/jpeg.js:21:4)
    at Parser.parse (node_modules/exif-parser/lib/parser.js:140:8)

, while the ordinary exif tool on the command line succeeds without any problems.

The latest PR added some robustness code at exactly the same position, but it doesn't seem to help here. Looks like it reads from an out of range offset instead. I'm not deep enough in this stuff to decide if the EXIF information is broken or if there's a LE/BE problem in the offset decoding.

Any idea?

mabrahao commented 3 weeks ago

I'm having the same issue here. Could you let me know if you figured out a solution for this? I'm running my code on a lambda function, and I don't want to rely on ExifTool