diff mbox series

[FFmpeg-devel,2/2] avformat/avisynth: make sure framedata variable is initialized

Message ID 20220219214153.2719-2-qyot27@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] avformat/avisynth: remove unused variable 'frameprop' | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_aarch64_jetson success Make finished
andriy/make_fate_aarch64_jetson success Make fate finished
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Stephen Hutchinson Feb. 19, 2022, 9:41 p.m. UTC
Addresses Coverity issue 1500290

Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
---
 libavformat/avisynth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Andreas Rheinhardt Feb. 19, 2022, 10:45 p.m. UTC | #1
Stephen Hutchinson:
> Addresses Coverity issue 1500290
> 
> Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
> ---
>  libavformat/avisynth.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
> index 03489f180f..cfb7b2a783 100644
> --- a/libavformat/avisynth.c
> +++ b/libavformat/avisynth.c
> @@ -244,7 +244,8 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
>      AviSynthContext *avs = s->priv_data;
>      const AVS_Map *avsmap;
>      AVS_VideoFrame *frame;
> -    int framedata, error;
> +    int framedata = 0;
> +    int error;
>      int planar = 0; // 0: packed, 1: YUV, 2: Y8, 3: Planar RGB, 4: YUVA, 5: Planar RGBA
>  
>      st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;

Looking at the naming in
https://github.com/AviSynth/AviSynthPlus/blob/master/avs_core/core/avisynth_c.cpp#L828
makes me believe that this variable is actually a frame number. If so,
it is misnamed and this could be fixed easily by just removing this
variable. Am I right?

- Andreas
Stephen Hutchinson Feb. 20, 2022, 12:05 a.m. UTC | #2
On 2/19/22 5:45 PM, Andreas Rheinhardt wrote:
> Stephen Hutchinson:
>> Addresses Coverity issue 1500290
>>
>> Signed-off-by: Stephen Hutchinson <qyot27@gmail.com>
>> ---
>>   libavformat/avisynth.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
>> index 03489f180f..cfb7b2a783 100644
>> --- a/libavformat/avisynth.c
>> +++ b/libavformat/avisynth.c
>> @@ -244,7 +244,8 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
>>       AviSynthContext *avs = s->priv_data;
>>       const AVS_Map *avsmap;
>>       AVS_VideoFrame *frame;
>> -    int framedata, error;
>> +    int framedata = 0;
>> +    int error;
>>       int planar = 0; // 0: packed, 1: YUV, 2: Y8, 3: Planar RGB, 4: YUVA, 5: Planar RGBA
>>   
>>       st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
> 
> Looking at the naming in
> https://github.com/AviSynth/AviSynthPlus/blob/master/avs_core/core/avisynth_c.cpp#L828
> makes me believe that this variable is actually a frame number. If so,
> it is misnamed and this could be fixed easily by just removing this
> variable. Am I right?
> 

It seems so.  I think I was just going off of the way avs_get_frame was 
used in avisynth_read_packet_video (as I was also trying to see whether 
some of the other properties* should be read per-frame from within 
read_packet_video), but there's no need to do that with the simpler ones 
in avisynth_create_stream_video.

*related to timestamps or to HDR mastering information, but I'm thinking 
that's going to require adding an entire function to the demuxer to be 
able to set side metadata (at least for the HDR stuff, anyway).
diff mbox series

Patch

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 03489f180f..cfb7b2a783 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -244,7 +244,8 @@  static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
     AviSynthContext *avs = s->priv_data;
     const AVS_Map *avsmap;
     AVS_VideoFrame *frame;
-    int framedata, error;
+    int framedata = 0;
+    int error;
     int planar = 0; // 0: packed, 1: YUV, 2: Y8, 3: Planar RGB, 4: YUVA, 5: Planar RGBA
 
     st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;