changeset 4453:22827cd6b228 libavcodec

Activate guards in avcodec_default_get_buffer. Patch by Michel Bardiaux, mbardiaux mediaxim dot be.
author takis
date Thu, 01 Feb 2007 09:45:05 +0000
parents c66326f1f635
children c9ce397604f0
files utils.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/utils.c	Wed Jan 31 23:04:56 2007 +0000
+++ b/utils.c	Thu Feb 01 09:45:05 2007 +0000
@@ -237,8 +237,14 @@
     InternalBuffer *buf;
     int *picture_number;
 
-    assert(pic->data[0]==NULL);
-    assert(INTERNAL_BUFFER_SIZE > s->internal_buffer_count);
+    if(pic->data[0]!=NULL) {
+        av_log(s, AV_LOG_ERROR, "pic->data[0]!=NULL in avcodec_default_get_buffer\n");
+        return -1;
+    }
+    if(s->internal_buffer_count >= INTERNAL_BUFFER_SIZE) {
+        av_log(s, AV_LOG_ERROR, "internal_buffer_count overflow (missing release_buffer?)\n");
+        return -1;
+    }
 
     if(avcodec_check_dimensions(s,w,h))
         return -1;