[FFmpeg-devel] [PATCH] mov: only read e_old if there were any old streams

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Sun Oct 30 21:11:32 EET 2016


This fixes a heap buffer overflow.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 357d800..95b546e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3028,7 +3028,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
             // Audio decoders like AAC need need a decoder delay samples previous to the current sample,
             // to correctly decode this frame. Hence for audio we seek to a frame 1 sec. before the
             // edit_list_media_time to cover the decoder delay.
-            search_timestamp = FFMAX(search_timestamp - mov->time_scale, e_old[0].timestamp);
+            search_timestamp = FFMAX(search_timestamp - mov->time_scale, nb_old ? e_old[0].timestamp : INT64_MIN);
         }
 
         index = find_prev_closest_keyframe_index(st, e_old, nb_old, search_timestamp, 0);
-- 
2.10.1


More information about the ffmpeg-devel mailing list