[FFmpeg-devel] [PATCH] avformat: Add check for ff_get_extradata
Paul B Mahol
onemda at gmail.com
Tue Feb 22 10:10:51 EET 2022
On Tue, Feb 22, 2022 at 8:50 AM Jiasheng Jiang <jiasheng at iscas.ac.cn> wrote:
> As the potential failure of the memory allocation, the ff_get_extradata()
> could return error if fails.
> Therefore, it should be better to deal with the return value of the
> ff_get_extradata() and return error if fails.
>
Not really necessary. Does not fix anything.
>
> Fixes: 2d720069a9 ("avformat: add aix demuxer")
> Signed-off-by: Jiasheng Jiang <jiasheng at iscas.ac.cn>
> ---
> libavformat/aixdec.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/aixdec.c b/libavformat/aixdec.c
> index 59c3d60da3..89f73b6913 100644
> --- a/libavformat/aixdec.c
> +++ b/libavformat/aixdec.c
> @@ -40,7 +40,7 @@ static int aix_read_header(AVFormatContext *s)
> unsigned segment_list_offset = 0x20;
> unsigned segment_list_entry_size = 0x10;
> unsigned size;
> - int i;
> + int i, ret;
>
> avio_skip(s->pb, 4);
> first_offset = avio_rb32(s->pb) + 8;
> @@ -77,7 +77,9 @@ static int aix_read_header(AVFormatContext *s)
> if (size <= 8)
> return AVERROR_INVALIDDATA;
> avio_skip(s->pb, 8);
> - ff_get_extradata(s, s->streams[i]->codecpar, s->pb, size - 8);
> + ret = ff_get_extradata(s, s->streams[i]->codecpar, s->pb, size -
> 8);
> + if (ret < 0)
> + return ret;
> }
>
> return 0;
> --
> 2.25.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>
More information about the ffmpeg-devel
mailing list