mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
avformat/avidec: Check read_odml_index() for failure
Fixes: Timeout
Fixes: 40950/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-6478873068437504
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 57adb26d05
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
9a44dc209b
commit
0afc4fb2e9
@ -232,6 +232,8 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num)
|
|||||||
} else {
|
} else {
|
||||||
int64_t offset, pos;
|
int64_t offset, pos;
|
||||||
int duration;
|
int duration;
|
||||||
|
int ret;
|
||||||
|
|
||||||
offset = avio_rl64(pb);
|
offset = avio_rl64(pb);
|
||||||
avio_rl32(pb); /* size */
|
avio_rl32(pb); /* size */
|
||||||
duration = avio_rl32(pb);
|
duration = avio_rl32(pb);
|
||||||
@ -249,7 +251,7 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num)
|
|||||||
if (avio_seek(pb, offset + 8, SEEK_SET) < 0)
|
if (avio_seek(pb, offset + 8, SEEK_SET) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
avi->odml_depth++;
|
avi->odml_depth++;
|
||||||
read_odml_index(s, frame_num);
|
ret = read_odml_index(s, frame_num);
|
||||||
avi->odml_depth--;
|
avi->odml_depth--;
|
||||||
frame_num += duration;
|
frame_num += duration;
|
||||||
|
|
||||||
@ -257,7 +259,8 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num)
|
|||||||
av_log(s, AV_LOG_ERROR, "Failed to restore position after reading index\n");
|
av_log(s, AV_LOG_ERROR, "Failed to restore position after reading index\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
avi->index_loaded = 2;
|
avi->index_loaded = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user