[libav-stable] nutenc: check for negative index rather than assert

Vittorio Giovara git at libav.org
Tue Oct 21 16:05:58 CEST 2014


Module: libav
Branch: master
Commit: b69183f65d0f6f4cd7a4e6c0deb57d59b0185aba

Author:    Vittorio Giovara <vittorio.giovara at gmail.com>
Committer: Vittorio Giovara <vittorio.giovara at gmail.com>
Date:      Mon Oct 20 14:11:20 2014 +0100

nutenc: check for negative index rather than assert

CC: libav-stable at 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 b68e00e..08907ef 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);



More information about the libav-stable mailing list