Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Steven Liu <lq@chinaffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Steven Liu <liuqi05@kuaishou.com>
Subject: [FFmpeg-devel] [PATCH 2/2] avutil/tx: add null pointer check after av_mallocz
Date: Fri, 28 Jan 2022 10:08:18 +0800
Message-ID: <20220128020818.39850-2-lq@chinaffmpeg.org> (raw)
In-Reply-To: <20220128020818.39850-1-lq@chinaffmpeg.org>

From: Steven Liu <liuqi05@kuaishou.com>

Fix CID: 1497863
there will get null pointer in attempt to initialize each if alloc memory failed.

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
---
 libavutil/tx.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavutil/tx.c b/libavutil/tx.c
index 50616adba7..79c9477d7f 100644
--- a/libavutil/tx.c
+++ b/libavutil/tx.c
@@ -567,6 +567,10 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
 
     if (!s->sub)
         s->sub = sub = av_mallocz(TX_MAX_SUB*sizeof(*sub));
+    if (!s->sub) {
+        ret = AVERROR(ENOMEM);
+        goto end;
+    }
 
     /* Attempt to initialize each */
     for (int i = 0; i < nb_cd_matches; i++) {
-- 
2.25.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2022-01-28  2:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28  2:08 [FFmpeg-devel] [PATCH 1/2] avutil/tx: remove deadcode of the control flow Steven Liu
2022-01-28  2:08 ` Steven Liu [this message]
     [not found] ` <20220128020818.39850-1-lq@chinaffmpeg.org-MuTRYJS--3-2>
2022-01-28  7:07   ` Lynne
     [not found]   ` <MuUVgkt--3-2@lynne.ee-MuUVl-q----2>
2022-01-28  7:30     ` Lynne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220128020818.39850-2-lq@chinaffmpeg.org \
    --to=lq@chinaffmpeg.org \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=liuqi05@kuaishou.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git