Message ID | 20170510163750.19352-1-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | 6b5d3fb26fb4be48e4966e4b1d97c2165538d4ef |
Headers | show |
Hi, On Wed, May 10, 2017 at 12:37 PM, Michael Niedermayer < michael@niedermayer.cc> wrote: > Fixes: out of array access > Fixes: 1434/clusterfuzz-testcase-minimized-6314998085189632 > Fixes: 1435/clusterfuzz-testcase-minimized-6483783723253760 > > Found-by: continuous fuzzing process https://github.com/google/oss- > fuzz/tree/master/targets/ffmpeg > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavcodec/vp8.c | 2 ++ > libavcodec/webp.c | 3 +-- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c > index fe7aa23491..5bf601a8ef 100644 > --- a/libavcodec/vp8.c > +++ b/libavcodec/vp8.c > @@ -2550,6 +2550,8 @@ int vp78_decode_frame(AVCodecContext *avctx, void > *data, int *got_frame, > enum AVDiscard skip_thresh; > VP8Frame *av_uninit(curframe), *prev_frame; > > + av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVA420P || avctx->pix_fmt == > AV_PIX_FMT_YUV420P); > + > if (is_vp7) > ret = vp7_decode_frame_header(s, avpkt->data, avpkt->size); > else > diff --git a/libavcodec/webp.c b/libavcodec/webp.c > index 16c3ae2662..e0cd72d03a 100644 > --- a/libavcodec/webp.c > +++ b/libavcodec/webp.c > @@ -1334,9 +1334,8 @@ static int vp8_lossy_decode_frame(AVCodecContext > *avctx, AVFrame *p, > if (!s->initialized) { > ff_vp8_decode_init(avctx); > s->initialized = 1; > - if (s->has_alpha) > - avctx->pix_fmt = AV_PIX_FMT_YUVA420P; > } > + avctx->pix_fmt = s->has_alpha ? AV_PIX_FMT_YUVA420P : > AV_PIX_FMT_YUV420P; > s->lossless = 0; > > if (data_size > INT_MAX) { > -- > 2.11.0 lgtm, thanks. Ronald
On Wed, May 10, 2017 at 02:07:02PM -0400, Ronald S. Bultje wrote: > Hi, > > On Wed, May 10, 2017 at 12:37 PM, Michael Niedermayer < > michael@niedermayer.cc> wrote: > > > Fixes: out of array access > > Fixes: 1434/clusterfuzz-testcase-minimized-6314998085189632 > > Fixes: 1435/clusterfuzz-testcase-minimized-6483783723253760 > > > > Found-by: continuous fuzzing process https://github.com/google/oss- > > fuzz/tree/master/targets/ffmpeg > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > > --- > > libavcodec/vp8.c | 2 ++ > > libavcodec/webp.c | 3 +-- > > 2 files changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c > > index fe7aa23491..5bf601a8ef 100644 > > --- a/libavcodec/vp8.c > > +++ b/libavcodec/vp8.c > > @@ -2550,6 +2550,8 @@ int vp78_decode_frame(AVCodecContext *avctx, void > > *data, int *got_frame, > > enum AVDiscard skip_thresh; > > VP8Frame *av_uninit(curframe), *prev_frame; > > > > + av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVA420P || avctx->pix_fmt == > > AV_PIX_FMT_YUV420P); > > + > > if (is_vp7) > > ret = vp7_decode_frame_header(s, avpkt->data, avpkt->size); > > else > > diff --git a/libavcodec/webp.c b/libavcodec/webp.c > > index 16c3ae2662..e0cd72d03a 100644 > > --- a/libavcodec/webp.c > > +++ b/libavcodec/webp.c > > @@ -1334,9 +1334,8 @@ static int vp8_lossy_decode_frame(AVCodecContext > > *avctx, AVFrame *p, > > if (!s->initialized) { > > ff_vp8_decode_init(avctx); > > s->initialized = 1; > > - if (s->has_alpha) > > - avctx->pix_fmt = AV_PIX_FMT_YUVA420P; > > } > > + avctx->pix_fmt = s->has_alpha ? AV_PIX_FMT_YUVA420P : > > AV_PIX_FMT_YUV420P; > > s->lossless = 0; > > > > if (data_size > INT_MAX) { > > -- > > 2.11.0 > > > lgtm, thanks. applied thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Complexity theory is the science of finding the exact solution to an approximation. Benchmarking OTOH is finding an approximation of the exact
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index fe7aa23491..5bf601a8ef 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -2550,6 +2550,8 @@ int vp78_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, enum AVDiscard skip_thresh; VP8Frame *av_uninit(curframe), *prev_frame; + av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVA420P || avctx->pix_fmt == AV_PIX_FMT_YUV420P); + if (is_vp7) ret = vp7_decode_frame_header(s, avpkt->data, avpkt->size); else diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 16c3ae2662..e0cd72d03a 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -1334,9 +1334,8 @@ static int vp8_lossy_decode_frame(AVCodecContext *avctx, AVFrame *p, if (!s->initialized) { ff_vp8_decode_init(avctx); s->initialized = 1; - if (s->has_alpha) - avctx->pix_fmt = AV_PIX_FMT_YUVA420P; } + avctx->pix_fmt = s->has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P; s->lossless = 0; if (data_size > INT_MAX) {
Fixes: out of array access Fixes: 1434/clusterfuzz-testcase-minimized-6314998085189632 Fixes: 1435/clusterfuzz-testcase-minimized-6483783723253760 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavcodec/vp8.c | 2 ++ libavcodec/webp.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-)