[FFmpeg-cvslog] tta: datalen is unsigned integer per reference library

Paul B Mahol git at videolan.org
Wed Oct 17 13:59:25 CEST 2012


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Oct 17 09:12:18 2012 +0000| [d6ea59b8608ddd214b61866bd86e965f62514a0c] | committer: Paul B Mahol

tta: datalen is unsigned integer per reference library

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

 libavformat/tta.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavformat/tta.c b/libavformat/tta.c
index 1440c80..445389e 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -44,8 +44,9 @@ static int tta_read_header(AVFormatContext *s)
 {
     TTAContext *c = s->priv_data;
     AVStream *st;
-    int i, channels, bps, samplerate, datalen;
+    int i, channels, bps, samplerate;
     uint64_t framepos, start_offset;
+    uint32_t datalen;
 
     if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX))
         ff_id3v1_read(s);
@@ -64,9 +65,9 @@ static int tta_read_header(AVFormatContext *s)
     }
 
     datalen = avio_rl32(s->pb);
-    if(datalen < 0){
-        av_log(s, AV_LOG_ERROR, "nonsense datalen\n");
-        return -1;
+    if (!datalen) {
+        av_log(s, AV_LOG_ERROR, "invalid datalen\n");
+        return AVERROR_INVALIDDATA;
     }
 
     avio_skip(s->pb, 4); // header crc



More information about the ffmpeg-cvslog mailing list