1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-08 13:22:53 +02:00

avformat/mlvdec: Check avio_read()

Fixes: use-of-uninitialized-value
Fixes: 383170476/clusterfuzz-testcase-minimized-ffmpeg_dem_MLV_fuzzer-4696002884337664

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit bb85423142)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-12-25 05:13:02 +01:00
parent cf7670f460
commit 25fcd936d8
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -79,13 +79,15 @@ static int check_file_header(AVIOContext *pb, uint64_t guid)
static void read_string(AVFormatContext *avctx, AVIOContext *pb, const char *tag, unsigned size)
{
char * value = av_malloc(size + 1);
int ret;
if (!value) {
avio_skip(pb, size);
return;
}
avio_read(pb, value, size);
if (!value[0]) {
ret = avio_read(pb, value, size);
if (ret != size || !value[0]) {
av_free(value);
return;
}