[FFmpeg-cvslog] avformat/apetag: More completely check avio_get_str() return value

Michael Niedermayer git at videolan.org
Sat Dec 6 17:25:25 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Dec  6 17:12:49 2014 +0100| [c149f67e9b5b4e3b9061e271e75d441bacfa81c6] | committer: Michael Niedermayer

avformat/apetag: More completely check avio_get_str() return value

This is not needed but its more proper to check the return value

Fixes CID1041122

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

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

 libavformat/apetag.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index c8d1bdc..258bdaa 100644
--- a/libavformat/apetag.c
+++ b/libavformat/apetag.c
@@ -62,15 +62,19 @@ static int ape_tag_read_field(AVFormatContext *s)
     if (flags & APE_TAG_FLAG_IS_BINARY) {
         uint8_t filename[1024];
         enum AVCodecID id;
+        int ret;
         AVStream *st = avformat_new_stream(s, NULL);
         if (!st)
             return AVERROR(ENOMEM);
 
-        size -= avio_get_str(pb, size, filename, sizeof(filename));
-        if (size <= 0) {
+        ret = avio_get_str(pb, size, filename, sizeof(filename));
+        if (ret < 0)
+            return ret;
+        if (size <= ret) {
             av_log(s, AV_LOG_WARNING, "Skipping binary tag '%s'.\n", key);
             return 0;
         }
+        size -= ret;
 
         av_dict_set(&st->metadata, key, filename, 0);
 



More information about the ffmpeg-cvslog mailing list