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>
Fri, 3 Oct 2014 01:40:58 +0000 (03: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 f8227d1..b627cd7 100644 (file)
@@ -684,7 +684,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 {
         if (seg->use_clocktime) {