[FFmpeg-cvslog] avcodec/pngdec: Use ff_set_dimensions()

Michael Niedermayer git at videolan.org
Thu May 4 20:48:43 EEST 2017


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu May  4 18:40:46 2017 +0200| [a0296fc056f0d86943c697c505a181744b07dd45] | committer: Michael Niedermayer

avcodec/pngdec: Use ff_set_dimensions()

Fixes OOM
Fixes: 1314/clusterfuzz-testcase-minimized-4621997222920192

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a0296fc056f0d86943c697c505a181744b07dd45
---

 libavcodec/pngdec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index aece1fcd5f..083f61f4f8 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -622,8 +622,9 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s,
     }
     if (!(s->pic_state & PNG_IDAT)) {
         /* init image info */
-        avctx->width  = s->width;
-        avctx->height = s->height;
+        ret = ff_set_dimensions(avctx, s->width, s->height);
+        if (ret < 0)
+            return ret;
 
         s->channels       = ff_png_get_nb_channels(s->color_type);
         s->bits_per_pixel = s->bit_depth * s->channels;



More information about the ffmpeg-cvslog mailing list