segment: don't access outside seg->frames array
authorMika Raento <mika.raento@elisa.fi>
Mon, 1 Sep 2014 17:10:03 +0000 (20:10 +0300)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 20 Sep 2014 16:40:32 +0000 (18:40 +0200)
Fixes wrong number of segments output and undefined memory access.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 58e0402e02ae5e466c33b9465c1465fdee68d342)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/segment.c

index ad313a3..9b4b44f 100644 (file)
@@ -666,7 +666,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
         end_pts = seg->segment_count < seg->nb_times ?
             seg->times[seg->segment_count] : INT64_MAX;
     } else if (seg->frames) {
-        start_frame = seg->segment_count <= seg->nb_frames ?
+        start_frame = seg->segment_count < seg->nb_frames ?
             seg->frames[seg->segment_count] : INT_MAX;
     } else {
         end_pts = seg->time * (seg->segment_count+1);