[FFmpeg-cvslog] riff: dont discard truncated metadata

Michael Niedermayer git at videolan.org
Thu Oct 18 16:13:46 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Oct 18 04:57:27 2012 +0200| [1350dffdc6ad27f604ed4cb3c8a6af3c005c3483] | committer: Michael Niedermayer

riff: dont discard truncated metadata

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavformat/riff.c b/libavformat/riff.c
index a919f3f..ee3542c 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -777,7 +777,7 @@ int ff_read_riff_info(AVFormatContext *s, int64_t size)
 
         chunk_size += (chunk_size & 1);
 
-        value = av_malloc(chunk_size + 1);
+        value = av_mallocz(chunk_size + 1);
         if (!value) {
             av_log(s, AV_LOG_ERROR, "out of memory, unable to read INFO tag\n");
             return AVERROR(ENOMEM);
@@ -786,13 +786,9 @@ int ff_read_riff_info(AVFormatContext *s, int64_t size)
         AV_WL32(key, chunk_code);
 
         if (avio_read(pb, value, chunk_size) != chunk_size) {
-            av_freep(&value);
-            av_log(s, AV_LOG_ERROR, "premature end of file while reading INFO tag\n");
-            return AVERROR_INVALIDDATA;
+            av_log(s, AV_LOG_WARNING, "premature end of file while reading INFO tag\n");
         }
 
-        value[chunk_size] = 0;
-
         av_dict_set(&s->metadata, key, value, AV_DICT_DONT_STRDUP_VAL);
     }
 



More information about the ffmpeg-cvslog mailing list