[gimp] Issue #5584: JPEG magics detection failure.



commit 47a68dc8717c01c726eda62f66350cead5372369
Author: Jehan <jehan girinstud io>
Date:   Wed Aug 26 12:13:29 2020 +0200

    Issue #5584: JPEG magics detection failure.
    
    Our currently registered JPEG magics was using possible fields at the
    start of the file (JFIF, Exif) in 7th byte. A JPEG provided in #5584 was
    starting with yet another field (apparently some Photoshop-specific
    field "Photoshop 3.0.8BIM") thus magics detection failed (and since
    extension was wrong, the file was sent to another plug-in, hence loading
    failed).
    
    Looking further, it looks like the 3 first bytes are actually always
    common to all JPEG and are the right magics/signature for a JPEG. These
    3 bytes don't seem to be used by other formats as well according to my
    research, which means we should not have false positives either. So
    let's switch to this magics 0XFFD8FF at byte 0.

 plug-ins/file-jpeg/jpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/plug-ins/file-jpeg/jpeg.c b/plug-ins/file-jpeg/jpeg.c
index daf8bd2396..e74216e1df 100644
--- a/plug-ins/file-jpeg/jpeg.c
+++ b/plug-ins/file-jpeg/jpeg.c
@@ -148,7 +148,7 @@ jpeg_create_procedure (GimpPlugIn  *plug_in,
       gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
                                           "jpg,jpeg,jpe");
       gimp_file_procedure_set_magics (GIMP_FILE_PROCEDURE (procedure),
-                                      "6,string,JFIF,6,string,Exif");
+                                      "0,string,\xff\xd8\xff");
 
       gimp_load_procedure_set_thumbnail_loader (GIMP_LOAD_PROCEDURE (procedure),
                                                 LOAD_THUMB_PROC);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]