diff mbox series

[FFmpeg-devel,1/8] avcodec/bitpacked: check av_buffer_ref result

Message ID 1633515251-5156-1-git-send-email-lance.lmwang@gmail.com
State Accepted
Commit 617cf44c8c56066e87f80c85218add82f1714ae0
Headers show
Series [FFmpeg-devel,1/8] avcodec/bitpacked: check av_buffer_ref result | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Lance Wang Oct. 6, 2021, 10:14 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/bitpacked.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/bitpacked.c b/libavcodec/bitpacked.c
index 8143151..0440df9 100644
--- a/libavcodec/bitpacked.c
+++ b/libavcodec/bitpacked.c
@@ -45,6 +45,10 @@  static int bitpacked_decode_uyvy422(AVCodecContext *avctx, AVFrame *frame,
     /* there is no need to copy as the data already match
      * a known pixel format */
     frame->buf[0] = av_buffer_ref(avpkt->buf);
+    if (!frame->buf[0]) {
+        return AVERROR(ENOMEM);
+    }
+
     ret = av_image_fill_arrays(frame->data, frame->linesize, avpkt->data,
                                avctx->pix_fmt, avctx->width, avctx->height, 1);
     if (ret < 0) {