pngdec: check for bprint finalization sucess on icc data parsing
authorRostislav Pehlivanov <atomnuker@gmail.com>
Thu, 9 Nov 2017 02:34:54 +0000 (02:34 +0000)
committerRostislav Pehlivanov <atomnuker@gmail.com>
Thu, 9 Nov 2017 02:34:54 +0000 (02:34 +0000)
It can fail in case of OOM.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
libavcodec/pngdec.c

index 0d6612c..5a3d288 100644 (file)
@@ -862,6 +862,8 @@ static int decode_iccp_chunk(PNGDecContext *s, int length, AVFrame *f)
         return ret;
 
     av_bprint_finalize(&bp, (char **)&data);
+    if (!data)
+        return AVERROR(ENOMEM);
 
     sd = av_frame_new_side_data(f, AV_FRAME_DATA_ICC_PROFILE, bp.len);
     if (!sd) {