aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/segafilm.c
diff options
context:
space:
mode:
authorLaurent Aimar <fenrir@videolan.org>2011-09-12 20:58:35 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-11-03 03:52:55 +0100
commitd6f8b65417f2170829a774ce07df7fdd34b32367 (patch)
tree951901237e7c834ea780bc1ed2780ef579b71728 /libavformat/segafilm.c
parentd8439f045220119d718968cf1023f5cd8182f877 (diff)
downloadffmpeg-d6f8b65417f2170829a774ce07df7fdd34b32367.tar.gz
segafilm: Check for memory allocation failures in segafilm demuxer.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 7cbe02575868e7d25acf3d319ece664702700f0a)
Diffstat (limited to 'libavformat/segafilm.c')
-rw-r--r--libavformat/segafilm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index ae1263cf98..b802b33461 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -167,6 +167,8 @@ static int film_read_header(AVFormatContext *s,
if(film->sample_count >= UINT_MAX / sizeof(film_sample))
return -1;
film->sample_table = av_malloc(film->sample_count * sizeof(film_sample));
+ if (!film->sample_table)
+ return AVERROR(ENOMEM);
for(i=0; i<s->nb_streams; i++)
av_set_pts_info(s->streams[i], 33, 1, film->base_clock);
@@ -238,6 +240,10 @@ static int film_read_packet(AVFormatContext *s,
av_free(film->stereo_buffer);
film->stereo_buffer_size = sample->sample_size;
film->stereo_buffer = av_malloc(film->stereo_buffer_size);
+ if (!film->stereo_buffer) {
+ film->stereo_buffer_size = 0;
+ return AVERROR(ENOMEM);
+ }
}
pkt->pos= url_ftell(pb);