[FFmpeg-cvslog] segafilm: fail earlier in case theres not enough bytestream left for a

Michael Niedermayer git at videolan.org
Sun Dec 25 05:02:27 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Dec 25 04:49:23 2011 +0100| [1795fed7bc7a8b8109757cb5f27198c5b05698b5] | committer: Michael Niedermayer

segafilm: fail earlier in case theres not enough bytestream left for a
audio packet.
This prevents a potentially large memory allocation.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1795fed7bc7a8b8109757cb5f27198c5b05698b5
---

 libavformat/segafilm.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index 17b118a..c2a163d 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -30,6 +30,7 @@
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "internal.h"
+#include "avio_internal.h"
 
 #define FILM_TAG MKBETAG('F', 'I', 'L', 'M')
 #define FDSC_TAG MKBETAG('F', 'D', 'S', 'C')
@@ -264,6 +265,8 @@ static int film_read_packet(AVFormatContext *s,
         (film->audio_type != CODEC_ID_ADPCM_ADX)) {
         /* stereo PCM needs to be interleaved */
 
+        if (ffio_limit(pb, sample->sample_size) != sample->sample_size)
+            return AVERROR(EIO);
         if (av_new_packet(pkt, sample->sample_size))
             return AVERROR(ENOMEM);
 



More information about the ffmpeg-cvslog mailing list