diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-01-27 12:41:49 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-01-30 05:41:00 +0300 |
commit | 827048268163bfe41438e0abbb2f8b131d3aa085 (patch) | |
tree | 10883fb0949acf68f5680728d400057f64b424b8 /libavformat/asfdec.c | |
parent | 13904b552b48e72bc472f98144ab54d0535ce99e (diff) |
asfdec: ensure that the whole tag is read.
Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net>
(cherry picked from commit 042950542d6ee70fde01e4edbb6e6da38ebbaf27)
Diffstat (limited to 'libavformat/asfdec.c')
-rw-r--r-- | libavformat/asfdec.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 229f8ba51d..eafb71d956 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -125,13 +125,14 @@ static int get_value(ByteIOContext *pb, int type){ static void get_tag(AVFormatContext *s, const char *key, int type, int len) { char *value; + int64_t off = url_ftell(s->pb); if ((unsigned)len >= (UINT_MAX - 1)/2) return; value = av_malloc(2*len+1); if (!value) - return; + goto finish; if (type == 0) { // UTF16-LE avio_get_str16le(s->pb, len, value, 2*len + 1); @@ -139,13 +140,13 @@ static void get_tag(AVFormatContext *s, const char *key, int type, int len) uint64_t num = get_value(s->pb, type); snprintf(value, len, "%"PRIu64, num); } else { - url_fskip(s->pb, len); - av_freep(&value); av_log(s, AV_LOG_DEBUG, "Unsupported value type %d in tag %s.\n", type, key); - return; + goto finish; } av_metadata_set2(&s->metadata, key, value, 0); +finish: av_freep(&value); + url_fseek(s->pb, off + len, SEEK_SET); } static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) |