From b69183f65d0f6f4cd7a4e6c0deb57d59b0185aba Mon Sep 17 00:00:00 2001
From: Vittorio Giovara <vittorio.giovara@gmail.com>
Date: Mon, 20 Oct 2014 14:11:20 +0100
Subject: [PATCH] nutenc: check for negative index rather than assert

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

diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index b68e00ebbca..08907ef4898 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -906,7 +906,10 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
             frame_code  = i;
         }
     }
-    assert(frame_code != -1);
+
+    if (frame_code < 0)
+        return AVERROR_BUG;
+
     fc           = &nut->frame_code[frame_code];
     flags        = fc->flags;
     needed_flags = get_needed_flags(nut, nus, fc, pkt);
-- 
GitLab