diff mbox series

[FFmpeg-devel] lavf/sr: fix the segmentation fault caused by incorrect input frame free.

Message ID 20220627100230.31863-1-ting.fu@intel.com
State Accepted
Commit 130d19bf2044ac76372d1b97ab87ab283c8b37f8
Headers show
Series [FFmpeg-devel] lavf/sr: fix the segmentation fault caused by incorrect input frame free. | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Fu, Ting June 27, 2022, 10:02 a.m. UTC
This issue would cause segmetaion fault when running srcnn model with
sr filter by TensorFlow backend. This filter would free the frame incorectly.

Signed-off-by: Ting Fu <ting.fu@intel.com>
---
 libavfilter/vf_sr.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Paul B Mahol June 27, 2022, 11:03 a.m. UTC | #1
lgtm
Fu, Ting July 21, 2022, 9:57 a.m. UTC | #2
Kindly ping

> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Paul B
> Mahol
> Sent: Monday, June 27, 2022 07:03 PM
> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] lavf/sr: fix the segmentation fault caused
> by incorrect input frame free.
> 
> lgtm
> _______________________________________________
> 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".
Guo, Yejun July 22, 2022, 12:41 a.m. UTC | #3
-----Original Message-----
From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Fu, Ting
Sent: 2022年7月21日 17:57
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] lavf/sr: fix the segmentation fault caused by incorrect input frame free.

Kindly ping

> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Paul 
> B Mahol
> Sent: Monday, June 27, 2022 07:03 PM
> To: FFmpeg development discussions and patches 
> <ffmpeg-devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] lavf/sr: fix the segmentation 
> fault caused by incorrect input frame free.
> 
> lgtm

Thanks, and lgtm, will push soon.
Andreas Rheinhardt July 22, 2022, 5:22 a.m. UTC | #4
Guo, Yejun:
> 
> 
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Fu, Ting
> Sent: 2022年7月21日 17:57
> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] lavf/sr: fix the segmentation fault caused by incorrect input frame free.
> 
> Kindly ping
> 
>> -----Original Message-----
>> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Paul 
>> B Mahol
>> Sent: Monday, June 27, 2022 07:03 PM
>> To: FFmpeg development discussions and patches 
>> <ffmpeg-devel@ffmpeg.org>
>> Subject: Re: [FFmpeg-devel] [PATCH] lavf/sr: fix the segmentation 
>> fault caused by incorrect input frame free.
>>
>> lgtm
> 
> Thanks, and lgtm, will push soon.

Fix the commit message when you do: lavf commonly means libavformat;
libavfilter is lavfi.

- Andreas
Gyan Doshi July 22, 2022, 5:31 a.m. UTC | #5
On 2022-07-22 10:52 am, Andreas Rheinhardt wrote:
> Guo, Yejun:
>>
>> -----Original Message-----
>> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Fu, Ting
>> Sent: 2022年7月21日 17:57
>> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
>> Subject: Re: [FFmpeg-devel] [PATCH] lavf/sr: fix the segmentation fault caused by incorrect input frame free.
>>
>> Kindly ping
>>
>>> -----Original Message-----
>>> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Paul
>>> B Mahol
>>> Sent: Monday, June 27, 2022 07:03 PM
>>> To: FFmpeg development discussions and patches
>>> <ffmpeg-devel@ffmpeg.org>
>>> Subject: Re: [FFmpeg-devel] [PATCH] lavf/sr: fix the segmentation
>>> fault caused by incorrect input frame free.
>>>
>>> lgtm
>> Thanks, and lgtm, will push soon.
> Fix the commit message when you do: lavf commonly means libavformat;
> libavfilter is lavfi.

This was pushed 5 hours ago, as-is.

Regard,
Gyan
diff mbox series

Patch

diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c
index 0890c8ba18..cb24c096ce 100644
--- a/libavfilter/vf_sr.c
+++ b/libavfilter/vf_sr.c
@@ -159,8 +159,9 @@  static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         sws_scale(ctx->sws_uv_scale, (const uint8_t **)(in->data + 2), in->linesize + 2,
                   0, ctx->sws_uv_height, out->data + 2, out->linesize + 2);
     }
-
-    av_frame_free(&in);
+    if (in != out) {
+        av_frame_free(&in);
+    }
     return ff_filter_frame(outlink, out);
 }