From 0d3a51e5d279dd2a56c81ba7a81a70128c5a7545 Mon Sep 17 00:00:00 2001 From: Oana Stratulat Date: Wed, 4 Jan 2012 03:13:27 +0200 Subject: [PATCH] electronicarts: Fix division by zero. Fixes Ticket #793 Signed-off-by: Oana Stratulat Signed-off-by: Michael Niedermayer --- libavformat/electronicarts.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 75f92afc0f..41ed0891b9 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -221,6 +221,10 @@ static int process_audio_header_eacs(AVFormatContext *s) ea->sample_rate = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb); ea->bytes = avio_r8(pb); /* 1=8-bit, 2=16-bit */ + if(ea->bytes == 0){ + av_log(s,AV_LOG_ERROR,"the file is corrupted, ea->bytes = 0\n"); + return AVERROR_INVALIDDATA; + } ea->num_channels = avio_r8(pb); compression_type = avio_r8(pb); avio_skip(pb, 13);