ping ?

On Sat, Apr 11, 2015, at 23:33, Thomas Guillem wrote:
> ---
> Hi,
> 
> If the flac_parser doesn't find any valid flac headers, it will continue
> to
> realloc the fifo_buf by step of 1024 bytes until it buffered the whole
> flac
> file. It can take some times, causes 100% of CPU usage, and use a lot of
> memory
> (the whole invalid file).
> 
> How to reproduce:
> $ dd if=/dev/zero of=invalid.flac bs=1014 count=30000
> $ avprobe invalid.flac
> 
> Best regards,
> Thomas Guillem.
> 
>  libavcodec/flac_parser.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
> index bf2c118..522ae89 100644
> --- a/libavcodec/flac_parser.c
> +++ b/libavcodec/flac_parser.c
> @@ -565,6 +565,13 @@ static int flac_parse(AVCodecParserContext *s,
> AVCodecContext *avctx,
>                                                nb_desired *
>                                                FLAC_AVG_FRAME_SIZE);
>          }
>  
> +        if (!av_fifo_space(fpc->fifo_buf) && !fpc->nb_headers_buffered)
> {
> +            /* There is no more space on the fifo but we don't have any
> headers
> +             * buffered. Therefore the fifo is most likely filled with
> invalid
> +             * data and the input is not a flac file. */
> +            goto handle_error;
> +        }
> +
>          /* Fill the buffer. */
>          if (av_fifo_realloc2(fpc->fifo_buf,
>                               (read_end - read_start) +
>                               av_fifo_size(fpc->fifo_buf)) < 0) {
> -- 
> 2.1.4
> 
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to