diff options
author | Laurent Aimar <fenrir@videolan.org> | 2011-09-12 21:09:57 +0200 |
---|---|---|
committer | Janne Grunau <janne-libav@jannau.net> | 2011-10-06 23:01:45 +0200 |
commit | 762ffa6861a8afefe11e1fe18e7b47c18d2d62f6 (patch) | |
tree | 67127468926567440c897f648eed9af95ab22670 /libavformat/segafilm.c | |
parent | 790f4dd5c96f948a637a90899b5f6af34ccb3942 (diff) | |
download | ffmpeg-762ffa6861a8afefe11e1fe18e7b47c18d2d62f6.tar.gz |
segafilm: Fix potential division by 0 on corrupted streams in the demuxer
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
Diffstat (limited to 'libavformat/segafilm.c')
-rw-r--r-- | libavformat/segafilm.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index 32a979f1a3..ea464f29fd 100644 --- a/libavformat/segafilm.c +++ b/libavformat/segafilm.c @@ -113,11 +113,14 @@ static int film_read_header(AVFormatContext *s, film->audio_bits = scratch[22]; if (scratch[23] == 2) film->audio_type = CODEC_ID_ADPCM_ADX; - else if (film->audio_bits == 8) - film->audio_type = CODEC_ID_PCM_S8; - else if (film->audio_bits == 16) - film->audio_type = CODEC_ID_PCM_S16BE; - else + else if (film->audio_channels > 0) { + if (film->audio_bits == 8) + film->audio_type = CODEC_ID_PCM_S8; + else if (film->audio_bits == 16) + film->audio_type = CODEC_ID_PCM_S16BE; + else + film->audio_type = CODEC_ID_NONE; + } else film->audio_type = CODEC_ID_NONE; } |