apetag: propagate errors.
authorRonald S. Bultje <rsbultje@gmail.com>
Thu, 23 Feb 2012 23:35:24 +0000 (15:35 -0800)
committerRonald S. Bultje <rsbultje@gmail.com>
Thu, 23 Feb 2012 23:53:26 +0000 (15:53 -0800)
Fixes crashes if reading the tag value fails.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
libavformat/apetag.c

index 6c65a1c..378ae10 100644 (file)
@@ -75,6 +75,8 @@ static int ape_tag_read_field(AVFormatContext *s)
         if (!value)
             return AVERROR(ENOMEM);
         c = avio_read(pb, value, size);
+        if (c < 0)
+            return c;
         value[c] = 0;
         av_dict_set(&s->metadata, key, value, AV_DICT_DONT_STRDUP_VAL);
     }