From: Michael Niedermayer <[email protected]>

Fixes use of uninitialized memory.

Sample-Id: msan_uninit-mem_7f4960453a02_7264_mr_cork_jpeg.mov
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Vittorio Giovara <[email protected]>
---
 libavformat/mov.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index e433f87..a3432b6 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -348,9 +348,8 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
         if (data_type == 3 || (data_type == 0 && (langcode < 0x400 || langcode 
== 0x7fff))) { // MAC Encoded
             mov_read_mac_string(c, pb, str_size, str, str_size_alloc);
         } else {
-            int ret = avio_read(pb, str, str_size);
-            if (ret != str_size)
-                return ret < 0 ? ret : AVERROR_INVALIDDATA;
+            if (avio_read(pb, str, str_size) != str_size)
+                return pb->error ? pb->error : AVERROR_EOF;
             str[str_size] = 0;
         }
         c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
-- 
1.9.3 (Apple Git-50)

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to