mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-06-16 04:32:47 +02:00
avformat/cafdec: fix negative index use in read_seek
av_index_search_timestamp() returns a negative value when a seek target
cannot be resolved from the stream index. Bail out before using that
result as an index into sti->index_entries to avoid out-of-bounds reads.
Fixes: Buffer underflow
Fixes: DFVULN-608
*Vulnerability reported by Zhenpeng (Leo) Lin at depthfirst*
*Patch validated by Zheng Yu at depthfirst*
(cherry picked from commit 5408059eb7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
Michael Niedermayer
parent
5d24736758
commit
d9cd659979
@@ -451,6 +451,8 @@ static int read_seek(AVFormatContext *s, int stream_index,
|
||||
frame_cnt = caf->frames_per_packet * packet_cnt;
|
||||
} else if (st->nb_index_entries) {
|
||||
packet_cnt = av_index_search_timestamp(st, timestamp, flags);
|
||||
if (packet_cnt < 0)
|
||||
return -1;
|
||||
frame_cnt = st->index_entries[packet_cnt].timestamp;
|
||||
pos = st->index_entries[packet_cnt].pos;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user