[FFmpeg-cvslog] ff_read_timestamp: check stream_index before using it as array index
Michael Niedermayer
git at videolan.org
Thu May 30 11:07:21 CEST 2013
ffmpeg | branch: release/1.1 | Michael Niedermayer <michaelni at gmx.at> | Mon Feb 18 19:48:44 2013 +0100| [2416eff5b9275e2e6e110f3ddbe7784586e4cd4f] | committer: Carl Eugen Hoyos
ff_read_timestamp: check stream_index before using it as array index
Fixes out of array read
Fixes ticket #2609.
Found-by: durandal_1707
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 695a766bff4cd8414a84e58159506d72b4e44892)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2416eff5b9275e2e6e110f3ddbe7784586e4cd4f
---
libavformat/utils.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index e85fa65..fc374f0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1765,7 +1765,10 @@ int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp,
static int64_t ff_read_timestamp(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit,
int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t ))
{
- return wrap_timestamp(s->streams[stream_index], read_timestamp(s, stream_index, ppos, pos_limit));
+ int64_t ts = read_timestamp(s, stream_index, ppos, pos_limit);
+ if (stream_index >= 0)
+ ts = wrap_timestamp(s->streams[stream_index], ts);
+ return ts;
}
int ff_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags)
More information about the ffmpeg-cvslog
mailing list