[FFmpeg-devel] [PATCH] avformat: Add check for ff_get_extradata
Jiasheng Jiang
jiasheng at iscas.ac.cn
Tue Feb 22 09:49:53 EET 2022
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.
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
More information about the ffmpeg-devel
mailing list