From: Vsevolod Stakhov Date: Mon, 4 Jul 2016 13:19:00 +0000 (+0100) Subject: [Feature] Support EXIF jpeg images X-Git-Tag: 1.3.0~184 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=683164999675314cb35353df413decbcd5489b45;p=rspamd.git [Feature] Support EXIF jpeg images --- diff --git a/src/libmime/images.c b/src/libmime/images.c index ff44ab489..bcb299f9c 100644 --- a/src/libmime/images.c +++ b/src/libmime/images.c @@ -21,7 +21,8 @@ static const guint8 png_signature[] = {137, 80, 78, 71, 13, 10, 26, 10}; static const guint8 jpg_sig1[] = {0xff, 0xd8}; -static const guint8 jpg_sig2[] = {'J', 'F', 'I', 'F'}; +static const guint8 jpg_sig_jfif[] = {0xff, 0xe0}; +static const guint8 jpg_sig_exif[] = {0xff, 0xe1}; static const guint8 gif_signature[] = {'G', 'I', 'F', '8'}; static const guint8 bmp_signature[] = {'B', 'M'}; @@ -54,7 +55,8 @@ detect_image_type (GByteArray *data) } if (data->len > 10) { if (memcmp (data->data, jpg_sig1, sizeof (jpg_sig1)) == 0) { - if (memcmp (data->data + 6, jpg_sig2, sizeof (jpg_sig2)) == 0) { + if (memcmp (data->data + 2, jpg_sig_jfif, sizeof (jpg_sig_jfif)) == 0 || + memcmp (data->data + 2, jpg_sig_exif, sizeof (jpg_sig_exif)) == 0) { return IMAGE_TYPE_JPG; } }