exif.go: Check for a long-enough EXIF header when searching.

pull/12/head
Dustin Oprea 2018-12-25 18:58:44 -05:00
parent 5409475851
commit bf0b550eff
1 changed files with 5 additions and 0 deletions

View File

@ -142,6 +142,11 @@ func ParseExifHeader(data []byte) (eh ExifHeader, err error) {
// CIPA DC-008-2016; JEITA CP-3451D
// -> http://www.cipa.jp/std/documents/e/DC-008-Translation-2016-E.pdf
if len(data) < 8 {
exifLogger.Warningf(nil, "Not enough data for EXIF header: (%d)", len(data))
log.Panic(ErrNoExif)
}
byteOrderBytes := [2]byte{data[0], data[1]}
byteOrder, found := ByteOrderLookup[byteOrderBytes]