From 62a22b2865f9afdadf0b6e272d002600803b17ec Mon Sep 17 00:00:00 2001 From: Nicolas Noirbent Date: Fri, 13 Jan 2012 09:58:15 +0100 Subject: [PATCH] segment: fix FPE when segment_list_size is 0 With the added benefit that allowing -segment_list_size 0 makes it possible to keep all segment entries in the list file. Signed-off-by: Michael Niedermayer --- libavformat/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/segment.c b/libavformat/segment.c index 89ae62d312..c75dd9c216 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -206,7 +206,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt) if (seg->list) { avio_printf(seg->pb, "%s\n", oc->filename); avio_flush(seg->pb); - if (!(seg->number % seg->size)) { + if (seg->size && !(seg->number % seg->size)) { avio_close(seg->pb); if ((ret = avio_open2(&seg->pb, seg->list, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL)) < 0)