[FFmpeg-cvslog] ea: check chunk_size for validity.

Ronald S. Bultje git at videolan.org
Sat May 5 20:36:36 CEST 2012


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Fri May  4 16:06:26 2012 -0700| [273e6af47b38391f2bcc157cca0423fe7fcbf55c] | committer: Ronald S. Bultje

ea: check chunk_size for validity.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org

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

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

diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index 47ef40f..b215547 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -487,12 +487,17 @@ static int ea_read_packet(AVFormatContext *s,
 
     while (!packet_read) {
         chunk_type = avio_rl32(pb);
-        chunk_size = (ea->big_endian ? avio_rb32(pb) : avio_rl32(pb)) - 8;
+        chunk_size = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb);
+        if (chunk_size <= 8)
+            return AVERROR_INVALIDDATA;
+        chunk_size -= 8;
 
         switch (chunk_type) {
         /* audio data */
         case ISNh_TAG:
             /* header chunk also contains data; skip over the header portion*/
+            if (chunk_size < 32)
+                return AVERROR_INVALIDDATA;
             avio_skip(pb, 32);
             chunk_size -= 32;
         case ISNd_TAG:



More information about the ffmpeg-cvslog mailing list