Some cameras don't provide the JFIF header, so don't require it.

This fixes DHT not being inserted on some images.
This commit is contained in:
Peter Johnson
2016-12-23 22:21:11 -08:00
parent 1575fff07a
commit 205d3b1d04

View File

@@ -58,9 +58,10 @@ bool IsJpeg(llvm::StringRef data) {
return false;
// Check for valid JPEG header (null terminated JFIF)
if (bytes[2] != 0xff || bytes[3] != 0xe0 || data.substr(6, 4) != "JFIF" ||
bytes[10] != 0x00)
if (bytes[2] == 0xff && bytes[3] == 0xe0) {
if (data.substr(6, 4) != "JFIF" || bytes[10] != 0x00)
return false;
}
return true;
}