vesacon: not all JPEG images are JFIF
authorH. Peter Anvin <hpa@zytor.com>
Mon, 7 Dec 2009 23:51:17 +0000 (15:51 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Mon, 7 Dec 2009 23:51:17 +0000 (15:51 -0800)
There are a fair number of valid JPEG images which we can validly
decode that aren't JFIF-complient, so don't require the JFIF header.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
com32/lib/sys/vesa/background.c

index 60ff1f2..256c824 100644 (file)
@@ -163,8 +163,7 @@ static int jpeg_sig_cmp(uint8_t * bytes, int len)
 {
     (void)len;
 
-    /* FF D8 = start of image, FF E0 = JFIF header */
-    return memcmp(bytes, "\xff\xd8\xff\xe0", 4) ? -1 : 0;
+    return (bytes[0] == 0xff && bytes[1] == 0xd8) ? 0 : -1;
 }
 
 static int read_jpeg_file(FILE * fp, uint8_t * header, int len)