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.
This commit is contained in:
Jehan
2020-08-26 12:13:29 +02:00
parent d7089c93b2
commit 47a68dc871

View File

@ -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);