summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-10-18 11:11:33 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-10-18 11:11:33 +0000
commit3c11a27b440e27c3796592aa8fb7fed966386a21 (patch)
tree1e6c3451b8e0ac0f2a0e38b6a6f2e1e821a86f3b /libavcodec/mpegvideo.c
parentabc4e5727e11b4caf1591d0b2b3e4308159d2ead (diff)
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 Originally committed as revision 10777 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 7a14dc1413..21fa5ed794 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -842,7 +842,19 @@ int ff_find_unused_picture(MpegEncContext *s, int shared){
}
}
- 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;
}