diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-12-25 04:49:23 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-03 22:32:39 +0100 |
commit | a80205ff82c9160e56c3eeffe4359c1fe9bfa32f (patch) | |
tree | aa3f803c37d714e3974e130ce334dc686a3841bc | |
parent | 0231a68ecd06cc894cc3e292a3c4cc015e40504a (diff) | |
download | ffmpeg-a80205ff82c9160e56c3eeffe4359c1fe9bfa32f.tar.gz |
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@gmx.at>
(cherry picked from commit 1795fed7bc7a8b8109757cb5f27198c5b05698b5)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/segafilm.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index 17b118a91c..c2a163d9fc 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); |