diff mbox series

[FFmpeg-devel] avformat/iamf_parse: Fix return of uninitialized value

Message ID D3UE2TQ1QWLS.18ZGE06K7PR84@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] avformat/iamf_parse: Fix return of uninitialized value | 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

Commit Message

Marvin Scholz Aug. 31, 2024, 8:45 p.m. UTC
The ret value here is not yet intialized so the return would return
uninitialized data. What was probably meant to be checked here was the
return value of ffio_read_size, which can return an error.

Introduced in 38bcb3ba7b3424abd772c72f8bdf445d75285e88

Fixes: CID1618758
---
 libavformat/iamf_parse.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


base-commit: fa5d3cc65309052402c6e3223d127b930b9e5699

Comments

James Almer Aug. 31, 2024, 9:17 p.m. UTC | #1
On 8/31/2024 5:45 PM, Marvin Scholz wrote:
> The ret value here is not yet intialized so the return would return
> uninitialized data. What was probably meant to be checked here was the
> return value of ffio_read_size, which can return an error.
> 
> Introduced in 38bcb3ba7b3424abd772c72f8bdf445d75285e88
> 
> Fixes: CID1618758
> ---
>   libavformat/iamf_parse.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
> index f13e76b147..8a0003634b 100644
> --- a/libavformat/iamf_parse.c
> +++ b/libavformat/iamf_parse.c
> @@ -98,8 +98,8 @@ static int aac_decoder_config(IAMFCodecConfig *codec_config,
>           return AVERROR(ENOMEM);
>   
>       codec_config->extradata_size = ffio_read_size(pb, codec_config->extradata, left);
> -    if (ret < 0)
> -        return ret;
> +    if (codec_config->extradata_size < 0)
> +        return codec_config->extradata_size;
>       memset(codec_config->extradata + codec_config->extradata_size, 0,
>              AV_INPUT_BUFFER_PADDING_SIZE);

LGTM. Please backport to 7.0 too.
Marvin Scholz Sept. 1, 2024, 3:12 p.m. UTC | #2
On 31 Aug 2024, at 23:17, James Almer wrote:

> On 8/31/2024 5:45 PM, Marvin Scholz wrote:
>> The ret value here is not yet intialized so the return would return
>> uninitialized data. What was probably meant to be checked here was the
>> return value of ffio_read_size, which can return an error.
>>
>> Introduced in 38bcb3ba7b3424abd772c72f8bdf445d75285e88
>>
>> Fixes: CID1618758
>> ---
>>   libavformat/iamf_parse.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
>> index f13e76b147..8a0003634b 100644
>> --- a/libavformat/iamf_parse.c
>> +++ b/libavformat/iamf_parse.c
>> @@ -98,8 +98,8 @@ static int aac_decoder_config(IAMFCodecConfig *codec_config,
>>           return AVERROR(ENOMEM);
>>        codec_config->extradata_size = ffio_read_size(pb, codec_config->extradata, left);
>> -    if (ret < 0)
>> -        return ret;
>> +    if (codec_config->extradata_size < 0)
>> +        return codec_config->extradata_size;
>>       memset(codec_config->extradata + codec_config->extradata_size, 0,
>>              AV_INPUT_BUFFER_PADDING_SIZE);
>
> LGTM. Please backport to 7.0 too.

You (or someone else who can) will have to merge and backport as I have no commit access.
Thanks.

>
>
> _______________________________________________
> 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".
James Almer Sept. 1, 2024, 4:27 p.m. UTC | #3
On 9/1/2024 12:12 PM, epirat07@gmail.com wrote:
> 
> 
> On 31 Aug 2024, at 23:17, James Almer wrote:
> 
>> On 8/31/2024 5:45 PM, Marvin Scholz wrote:
>>> The ret value here is not yet intialized so the return would return
>>> uninitialized data. What was probably meant to be checked here was the
>>> return value of ffio_read_size, which can return an error.
>>>
>>> Introduced in 38bcb3ba7b3424abd772c72f8bdf445d75285e88
>>>
>>> Fixes: CID1618758
>>> ---
>>>    libavformat/iamf_parse.c | 4 ++--
>>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
>>> index f13e76b147..8a0003634b 100644
>>> --- a/libavformat/iamf_parse.c
>>> +++ b/libavformat/iamf_parse.c
>>> @@ -98,8 +98,8 @@ static int aac_decoder_config(IAMFCodecConfig *codec_config,
>>>            return AVERROR(ENOMEM);
>>>         codec_config->extradata_size = ffio_read_size(pb, codec_config->extradata, left);
>>> -    if (ret < 0)
>>> -        return ret;
>>> +    if (codec_config->extradata_size < 0)
>>> +        return codec_config->extradata_size;
>>>        memset(codec_config->extradata + codec_config->extradata_size, 0,
>>>               AV_INPUT_BUFFER_PADDING_SIZE);
>>
>> LGTM. Please backport to 7.0 too.
> 
> You (or someone else who can) will have to merge and backport as I have no commit access.
> Thanks.

Already did, thanks.
diff mbox series

Patch

diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
index f13e76b147..8a0003634b 100644
--- a/libavformat/iamf_parse.c
+++ b/libavformat/iamf_parse.c
@@ -98,8 +98,8 @@  static int aac_decoder_config(IAMFCodecConfig *codec_config,
         return AVERROR(ENOMEM);
 
     codec_config->extradata_size = ffio_read_size(pb, codec_config->extradata, left);
-    if (ret < 0)
-        return ret;
+    if (codec_config->extradata_size < 0)
+        return codec_config->extradata_size;
     memset(codec_config->extradata + codec_config->extradata_size, 0,
            AV_INPUT_BUFFER_PADDING_SIZE);