[FFmpeg-cvslog] tta: better check for totalframes.

Michael Niedermayer git at videolan.org
Sun Nov 27 15:56:38 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Nov 27 15:37:15 2011 +0100| [b7c7eae7d995b54765c3d7a027cd8b542f777fa1] | committer: Michael Niedermayer

tta: better check for totalframes.
Avoids crash, Fixes Ticket 690

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/tta.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/tta.c b/libavformat/tta.c
index 4d0c6ad..470ee2b 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -72,8 +72,8 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
     c->totalframes = datalen / framelen + ((datalen % framelen) ? 1 : 0);
     c->currentframe = 0;
 
-    if(c->totalframes >= UINT_MAX/sizeof(uint32_t)){
-        av_log(s, AV_LOG_ERROR, "totalframes too large\n");
+    if(c->totalframes >= UINT_MAX/sizeof(uint32_t) || c->totalframes <= 0){
+        av_log(s, AV_LOG_ERROR, "totalframes %d invalid\n", c->totalframes);
         return -1;
     }
 



More information about the ffmpeg-cvslog mailing list