[FFmpeg-devel] [PATCH] riffdec: error out on negative bit rate

Michael Niedermayer michael at niedermayer.cc
Sat Jul 11 01:59:32 CEST 2015


On Sat, Jul 11, 2015 at 01:26:23AM +0200, Andreas Cadhalpun wrote:
> On 11.07.2015 00:49, Michael Niedermayer wrote:
> > On Sat, Jul 11, 2015 at 12:39:09AM +0200, Andreas Cadhalpun wrote:
> >> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> >> ---
> >>  libavformat/riffdec.c | 5 +++++
> >>  1 file changed, 5 insertions(+)
> >>
> >> diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
> >> index eebd8ed..be55699 100644
> >> --- a/libavformat/riffdec.c
> >> +++ b/libavformat/riffdec.c
> >> @@ -106,6 +106,11 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size, int big_
> >>          codec->bit_rate    = avio_rb32(pb) * 8;
> >>          codec->block_align = avio_rb16(pb);
> >>      }
> >> +    if (codec->bit_rate < 0) {
> >> +        av_log(NULL, AV_LOG_ERROR,
> >> +               "Invalid bit rate: %d\n", codec->bit_rate);
> >> +        return AVERROR_INVALIDDATA;
> >> +    }
> > 
> > i think it might be better to just warn on a invalid bitrate and only
> > error out if AV_EF_EXPLODE is set
> > because erroring out from header reading coul end all
> > further decoding of that stream (which might in principle be fine
> > otherwise)
> 
> Makes sense, new patch attached.
> Note however that the explode mode doesn't necessarily work, because e.g.
> the avi demuxer doesn't set err_recognition for the AVCodecContext.
> 
> Best regards,
> Andreas
> 
> 
> 

>  riffdec.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
> 9441e980c777560333151e0fce018d24a3cd207f  0001-riffdec-prevent-negative-bit-rate.patch
> From 10b32efc74f6e1795a02cfcf84fd0e82c5b1dcdc Mon Sep 17 00:00:00 2001
> From: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> Date: Sat, 11 Jul 2015 00:09:46 +0200
> Subject: [PATCH] riffdec: prevent negative bit rate

LGTM

thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150711/9a28604d/attachment.sig>


More information about the ffmpeg-devel mailing list