[FFmpeg-cvslog] id3v2: catch avio_read errors in check_tag

Andreas Cadhalpun git at videolan.org
Thu May 14 20:58:43 CEST 2015


ffmpeg | branch: release/2.6 | Andreas Cadhalpun <andreas.cadhalpun at googlemail.com> | Mon May 11 20:07:49 2015 +0200| [66b95ee4df804cb18dd39def251cc967f1abf808] | committer: Andreas Cadhalpun

id3v2: catch avio_read errors in check_tag

Since len is an unsigned int, the comparison is currently treated as
unsigned and thus ignores all errors from avio_read.

Thus cast len to int, which is unproblematic, because at that point len
is between 0 and 4.

This fixes 'Conditional jump or move depends on uninitialised value'
valgrind warnings in is_tag.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 0382c94f13b4b20456b7259e90b170dc020419b8)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

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

 libavformat/id3v2.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index a8273e2..2918ef6 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -205,7 +205,7 @@ static int check_tag(AVIOContext *s, int offset, unsigned int len)
 
     if (len > 4 ||
         avio_seek(s, offset, SEEK_SET) < 0 ||
-        avio_read(s, tag, len) < len)
+        avio_read(s, tag, len) < (int)len)
         return -1;
     else if (!AV_RB32(tag) || is_tag(tag, len))
         return 1;



More information about the ffmpeg-cvslog mailing list