summaryrefslogtreecommitdiff
path: root/libavformat/img2dec.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2015-01-09 00:30:02 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2015-01-09 00:30:02 +0100
commitcd3405282c7007a535b297d14e50e4ff12c18679 (patch)
tree017ec38d864b047c12be6f33a2028fee9906918f /libavformat/img2dec.c
parent6d1a2efb8ac399a003ea7d3b6f8c641d192567ee (diff)
Skip Exif data when auto-detecting jpeg images.
Diffstat (limited to 'libavformat/img2dec.c')
-rw-r--r--libavformat/img2dec.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 015a20ad85..329e61d0c4 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -643,14 +643,18 @@ static int j2k_probe(AVProbeData *p)
static int jpeg_probe(AVProbeData *p)
{
const uint8_t *b = p->buf;
- int i, state = 0xD8;
+ int i, state = 0xD8, exif_size = 0;
if (AV_RB16(b) != 0xFFD8 ||
AV_RB32(b) == 0xFFD8FFF7)
return 0;
b += 2;
- for (i = 0; i < p->buf_size - 2; i++) {
+ if (AV_RB16(b) == 0xFFE1 && AV_RB32(b + 4) == AV_RB32("Exif")) {
+ exif_size = AV_RB16(b + 2) + 2;
+ b += exif_size;
+ }
+ for (i = 0; i + exif_size < p->buf_size - 2; i++) {
int c;
if (b[i] != 0xFF)
continue;