changeset 5836:0859108b4ae3 libavcodec

replace (disabled by default) assert(0) by abort() if the picture buffer overflows due to a buggy codec note, ive not checked if such overflows could have been exploitable before this commit
author michael
date Thu, 18 Oct 2007 11:11:33 +0000
parents 74db54e5f428
children 4400d47f7c91
files mpegvideo.c
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mpegvideo.c	Thu Oct 18 09:34:49 2007 +0000
+++ b/mpegvideo.c	Thu Oct 18 11:11:33 2007 +0000
@@ -842,7 +842,19 @@
         }
     }
 
-    assert(0);
+    av_log(s->avctx, AV_LOG_FATAL, "Internal error, picture buffer overflow\n");
+    /*we could return -1 but the codec would crash anyway, trying to draw
+      into, a non existing frame, this is safer than waiting for a random crash
+      also the return of this is never usefull, a encoder must only allocate
+      as many as allowed in the spec which has no relation to how many lavc
+      could allocate (and MAX_PICTURE_COUNT is always large enough for such
+      valid streams)
+      and a decoder has to check stream validity and remove frames if too many
+      reference frames are around. waiting for "OOM" is not correct at all, it
+      similarely has to replace missing reference frames by (interpolated/MC)
+      frames anything else is a bug in the codec ...
+    */
+    abort();
     return -1;
 }