aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-04 18:40:46 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-17 20:35:19 +0200
commit79d027ae7ca8bce31c613af4c1e73fbf5d448bf0 (patch)
tree64d4c8c3bab6dd90f5e3595d9552d9bffd842ed2
parent32f047ce5c7aa6e46fe9702e23b871d6a53f074e (diff)
downloadffmpeg-79d027ae7ca8bce31c613af4c1e73fbf5d448bf0.tar.gz
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@niedermayer.cc> (cherry picked from commit a0296fc056f0d86943c697c505a181744b07dd45) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/pngdec.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index c2da1f66d5..0bc8252465 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -611,8 +611,9 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s,
}
if (!(s->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;