From 3a6dfec864d569c2d0a875e1a7466f51b00edb63 Mon Sep 17 00:00:00 2001
From: Vittorio Giovara <vittorio.giovara@gmail.com>
Date: Thu, 22 Jan 2015 20:13:45 +0000
Subject: [PATCH] segment: Check av_get_frame_filename() return value

CC: libav-stable@libav.org
Bug-Id: CID 1265713
---
 libavformat/segment.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/segment.c b/libavformat/segment.c
index bcfd1f99736..824bbf7d5b6 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -105,7 +105,11 @@ static int segment_hls_window(AVFormatContext *s, int last)
         if (seg->entry_prefix) {
             avio_printf(seg->pb, "%s", seg->entry_prefix);
         }
-        av_get_frame_filename(buf, sizeof(buf), s->filename, i);
+        ret = av_get_frame_filename(buf, sizeof(buf), s->filename, i);
+        if (ret < 0) {
+            ret = AVERROR(EINVAL);
+            goto fail;
+        }
         avio_printf(seg->pb, "%s\n", buf);
     }
 
-- 
GitLab