Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/2] avutil/tx: remove deadcode of the control flow
@ 2022-01-28  2:08 Steven Liu
  2022-01-28  2:08 ` [FFmpeg-devel] [PATCH 2/2] avutil/tx: add null pointer check after av_mallocz Steven Liu
       [not found] ` <20220128020818.39850-1-lq@chinaffmpeg.org-MuTRYJS--3-2>
  0 siblings, 2 replies; 4+ messages in thread
From: Steven Liu @ 2022-01-28  2:08 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Steven Liu

From: Steven Liu <liuqi05@kuaishou.com>

Fix CID: 1497864
The control flow should return ENOSYS if nb_cd_matches is 0 at before
and the ret equal AVERROR(ENOMEM) or goto end label, so remove the last
control flow if (ret >= 0) before end label.

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

diff --git a/libavutil/tx.c b/libavutil/tx.c
index 2897f3bd35..50616adba7 100644
--- a/libavutil/tx.c
+++ b/libavutil/tx.c
@@ -601,9 +601,6 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
 
     av_free(sub);
 
-    if (ret >= 0)
-        ret = AVERROR(ENOSYS);
-
 end:
     av_free(cd_matches);
     return ret;
-- 
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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [FFmpeg-devel] [PATCH 2/2] avutil/tx: add null pointer check after av_mallocz
  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
       [not found] ` <20220128020818.39850-1-lq@chinaffmpeg.org-MuTRYJS--3-2>
  1 sibling, 0 replies; 4+ messages in thread
From: Steven Liu @ 2022-01-28  2:08 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Steven Liu

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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/2] avutil/tx: remove deadcode of the control flow
       [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>
  1 sibling, 0 replies; 4+ messages in thread
From: Lynne @ 2022-01-28  7:07 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

28 Jan 2022, 03:08 by lq@chinaffmpeg.org:

> From: Steven Liu <liuqi05@kuaishou.com>
>
> Fix CID: 1497864
> The control flow should return ENOSYS if nb_cd_matches is 0 at before
> and the ret equal AVERROR(ENOMEM) or goto end label, so remove the last
> control flow if (ret >= 0) before end label.
>
> Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
> ---
>  libavutil/tx.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/libavutil/tx.c b/libavutil/tx.c
> index 2897f3bd35..50616adba7 100644
> --- a/libavutil/tx.c
> +++ b/libavutil/tx.c
> @@ -601,9 +601,6 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
>  
>  av_free(sub);
>  
> -    if (ret >= 0)
> -        ret = AVERROR(ENOSYS);
> -
>  end:
>  av_free(cd_matches);
>  return ret;
>

Sorry, neither of those is correct.
I'll push my own.
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/2] avutil/tx: remove deadcode of the control flow
       [not found]   ` <MuUVgkt--3-2@lynne.ee-MuUVl-q----2>
@ 2022-01-28  7:30     ` Lynne
  0 siblings, 0 replies; 4+ messages in thread
From: Lynne @ 2022-01-28  7:30 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

28 Jan 2022, 08:07 by dev@lynne.ee:

> 28 Jan 2022, 03:08 by lq@chinaffmpeg.org:
>
>> From: Steven Liu <liuqi05@kuaishou.com>
>>
>> Fix CID: 1497864
>> The control flow should return ENOSYS if nb_cd_matches is 0 at before
>> and the ret equal AVERROR(ENOMEM) or goto end label, so remove the last
>> control flow if (ret >= 0) before end label.
>>
>> Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
>> ---
>>  libavutil/tx.c | 3 ---
>>  1 file changed, 3 deletions(-)
>>
>> diff --git a/libavutil/tx.c b/libavutil/tx.c
>> index 2897f3bd35..50616adba7 100644
>> --- a/libavutil/tx.c
>> +++ b/libavutil/tx.c
>> @@ -601,9 +601,6 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
>>  
>>  av_free(sub);
>>  
>> -    if (ret >= 0)
>> -        ret = AVERROR(ENOSYS);
>> -
>>  end:
>>  av_free(cd_matches);
>>  return ret;
>>
>
> Sorry, neither of those is correct.
> I'll push my own.
>

Had been thinking about eliminating context allocations if
the codelet requires no context, but I decided it's too much trouble.
Pushed both as-is, with some minor change on the malloc test.
Thanks. I should get Coverity access too some day.
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-28  7:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [FFmpeg-devel] [PATCH 2/2] avutil/tx: add null pointer check after av_mallocz Steven Liu
     [not found] ` <20220128020818.39850-1-lq@chinaffmpeg.org-MuTRYJS--3-2>
2022-01-28  7:07   ` [FFmpeg-devel] [PATCH 1/2] avutil/tx: remove deadcode of the control flow Lynne
     [not found]   ` <MuUVgkt--3-2@lynne.ee-MuUVl-q----2>
2022-01-28  7:30     ` Lynne

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