[FFmpeg-devel] [PATCH] oggdec: in ogg_read_header(), fail if ogg_get_length() fails

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue May 24 20:22:36 CEST 2011


On Tue, May 24, 2011 at 04:18:34PM +0200, Stefano Sabatini wrote:
> Check error value of ogg_get_length(), and return its error code in
> case of failure. This looks required in case of memory problems.
> ---
>  libavformat/oggdec.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
> index 704cab0..f159af4 100644
> --- a/libavformat/oggdec.c
> +++ b/libavformat/oggdec.c
> @@ -529,7 +529,8 @@ static int ogg_read_header(AVFormatContext *s, AVFormatParameters *ap)
>      //linear granulepos seek from end
> -    ogg_get_length (s);
> +    if ((ret = ogg_get_length(s)) < 0)
> +        return ret;
>  
>      //fill the extradata in the per codec callbacks
>      return 0;

Not completely sure it is a good idea, but this could be
simplified to single line:
return ogg_get_length(s);


More information about the ffmpeg-devel mailing list