[FFmpeg-devel] [PATCH] matroska: Ensure sample rate is always >= 1.

Dale Curtis dalecurtis at chromium.org
Thu Apr 19 23:22:28 CEST 2012


On Thu, Apr 19, 2012 at 1:31 PM, Michael Niedermayer <michaelni at gmx.at>wrote:

> On Mon, Apr 16, 2012 at 06:05:27PM -0700, dalecurtis at chromium.org wrote:
> > From: Dale Curtis <dalecurtis at chromium.org>
> >
> > May no longer be necessary, but seems like a valid
> > enforcement.
> >
> > Signed-off-by: Dale Curtis <dalecurtis at chromium.org>
> > ---
> >  libavformat/matroskadec.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> > index a484c50..cdaeff7 100644
> > --- a/libavformat/matroskadec.c
> > +++ b/libavformat/matroskadec.c
> > @@ -1680,7 +1680,7 @@ static int matroska_read_header(AVFormatContext *s)
> >              }
> >          } else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) {
> >              st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
> > -            st->codec->sample_rate = track->audio.out_samplerate;
> > +            st->codec->sample_rate = FFMAX(1,
> track->audio.out_samplerate);
>
> What does or did this fix ?
>
>
The change was made after an audit by our security team at the dawn of
Chrome a couple years ago. The test cases associated with that audit don't
reproduce any visible issues anymore:

http://commondatastorage.googleapis.com/dalecurtis-shared/old-test-cases.tar.bz2


Before submitting, I reviewed the current code and didn't see anything
questionable, most consumers of the sample_rate are guarded by a <= check.
However, instead of just tossing the patch I figured I'd see if anyone on
here had some thoughts first.

- dale


More information about the ffmpeg-devel mailing list