[FFmpeg-cvslog] avformat/aviobuf: Fix end check in put_str16()

Michael Niedermayer git at videolan.org
Fri Jan 15 17:39:21 CET 2016


ffmpeg | branch: release/2.6 | Michael Niedermayer <michael at niedermayer.cc> | Wed Jan 13 02:31:59 2016 +0100| [6d5fca34a629daaa1941942130961ffa08bf56a1] | committer: Michael Niedermayer

avformat/aviobuf: Fix end check in put_str16()

Fixes out of array read
Fixes: 03c406ec9530e594a074ce2979f8a1f0/asan_heap-oob_7dec26_4664_37c52495b2870a2eaac65f53958e76c1.flac

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 115fb6d03ef6310732b42258d8c3cd1839cfb74b)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/aviobuf.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index db066f8..3cb8c82 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -359,6 +359,8 @@ static inline int put_str16(AVIOContext *s, const char *str, const int be)
 invalid:
         av_log(s, AV_LOG_ERROR, "Invaid UTF8 sequence in avio_put_str16%s\n", be ? "be" : "le");
         err = AVERROR(EINVAL);
+        if (!*(q-1))
+            break;
     }
     if (be)
         avio_wb16(s, 0);



More information about the ffmpeg-cvslog mailing list