[FFmpeg-devel] [PATCH] avformat: Fix probing on some JPEGs
Nikolas Bowe
nbowe at google.com
Tue Aug 20 04:36:48 EEST 2019
Fixes "Invalid data found when processing input" on some JPEGs.
Some large extensionless JPEGs can get probe score collisions.
eg
$ ffprobe -loglevel trace /tmp/foo
[NULL @ 0x55c130ab04c0] Opening '/tmp/foo' for reading
[file @ 0x55c130ab0f40] Setting default whitelist 'file,crypto'
Probing jpeg_pipe score:6 size:2048
Probing jpeg_pipe score:6 size:4096
Probing jpeg_pipe score:6 size:8192
Probing jpeg_pipe score:6 size:16384
Probing jpeg_pipe score:25 size:32768
Probing jpeg_pipe score:25 size:65536
Probing jpeg_pipe score:25 size:131072
Probing jpeg_pipe score:25 size:262144
Probing jpeg_pipe score:25 size:524288
Probing mpeg score:25 size:1048576
Probing jpeg_pipe score:25 size:1048576
[AVIOContext @ 0x55c130ab9300] Statistics: 1048576 bytes read, 0 seeks
/tmp/foo: Invalid data found when processing input
This patch fixes this by bumping the score in the start-of-scan data.
---
Fixes adsadasda
asd
libavformat/img2dec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index f8b4a655a5..cb582f97cb 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -767,7 +767,7 @@ static int jpeg_probe(const AVProbeData *p)
if (state == EOI)
return AVPROBE_SCORE_EXTENSION + 1;
if (state == SOS)
- return AVPROBE_SCORE_EXTENSION / 2;
+ return AVPROBE_SCORE_EXTENSION / 2 + 1;
return AVPROBE_SCORE_EXTENSION / 8;
}
--
2.23.0.rc1.153.gdeed80330f-goog
More information about the ffmpeg-devel
mailing list