[FFmpeg-cvslog] electronicarts: check bytes per sample for validity

Janne Grunau git at videolan.org
Thu May 3 01:44:29 CEST 2012


ffmpeg | branch: release/0.9 | Janne Grunau <janne-libav at jannau.net> | Thu Jan  5 22:12:35 2012 +0100| [e390a9de6f04eb081b66c8a81a88b17e08c5e605] | committer: Michael Niedermayer

electronicarts: check bytes per sample for validity

Prevents division by zero.

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

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

diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index 43d1f26..53041ee 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -440,6 +440,11 @@ static int ea_read_header(AVFormatContext *s,
             ea->audio_codec = 0;
             return 1;
         }
+        if (ea->bytes <= 0) {
+            av_log(s, AV_LOG_ERROR, "Invalid number of bytes per sample: %d\n", ea->bytes);
+            ea->audio_codec = CODEC_ID_NONE;
+            return 1;
+        }
 
         /* initialize the audio decoder stream */
         st = avformat_new_stream(s, NULL);



More information about the ffmpeg-cvslog mailing list