[libav-devel] [PATCH] libschroedingerenc: do not assert on values from external libraries

Alexandra Khirnova alexandra.khirnova at gmail.com
Thu Nov 21 22:06:31 CET 2013


---
 libavcodec/libschroedingerenc.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavcodec/libschroedingerenc.c b/libavcodec/libschroedingerenc.c
index c2aac53..3dc1481 100644
--- a/libavcodec/libschroedingerenc.c
+++ b/libavcodec/libschroedingerenc.c
@@ -27,9 +27,6 @@
 * (http://dirac.sourceforge.net/specification.html).
 */
 
-#undef NDEBUG
-#include <assert.h>
-
 #include <schroedinger/schro.h>
 #include <schroedinger/schrodebug.h>
 #include <schroedinger/schrovideoformat.h>
@@ -302,8 +299,8 @@ static int libschroedinger_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
         case SCHRO_STATE_HAVE_BUFFER:
         case SCHRO_STATE_END_OF_STREAM:
             enc_buf = schro_encoder_pull(encoder, &presentation_frame);
-            assert(enc_buf->length > 0);
-            assert(enc_buf->length <= buf_size);
+            if (enc_buf->length <= 0)
+                return AVERROR_BUG;
             parse_code = enc_buf->data[4];
 
             /* All non-frame data is prepended to actual frame data to
-- 
1.7.10.4



More information about the libav-devel mailing list