[gimp/gimp-2-10] Issue #5584: JPEG magics detection failure.



commit ed671d7eacc5302c2e241d81071978dc5bc56894
Author: Jehan <jehan girinstud io>
Date:   Wed Aug 26 12:21:33 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.
    
    Note: same as commit 47a68dc871 on master but on old 2.10 API.

 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 b1e77ff6e7..90f42fb292 100644
--- a/plug-ins/file-jpeg/jpeg.c
+++ b/plug-ins/file-jpeg/jpeg.c
@@ -129,7 +129,7 @@ query (void)
   gimp_register_magic_load_handler (LOAD_PROC,
                                     "jpg,jpeg,jpe",
                                     "",
-                                    "6,string,JFIF,6,string,Exif");
+                                    "0,string,\xff\xd8\xff");
 
   gimp_install_procedure (LOAD_THUMB_PROC,
                           "Loads a thumbnail from a JPEG image",


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