[FFmpeg-devel] [PATCH] avformat: Fix probing on some JPEGs

Carl Eugen Hoyos ceffmpeg at gmail.com
Tue Aug 20 04:50:34 EEST 2019


Am Di., 20. Aug. 2019 um 03:37 Uhr schrieb Nikolas Bowe
<nbowe-at-google.com at ffmpeg.org>:
>
> 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;

This score would mean that mjpeg can never be detected.
I suspect you have to reduce one of the demuxers to "- 1".

Carl Eugen


More information about the ffmpeg-devel mailing list