aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-01-13 02:31:59 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-01-15 16:00:31 +0100
commita2b234b917bf15fd0f60c131b801f0f84bf14ef4 (patch)
tree4982e49cb0ff2740eb7970c94fd50f58607f9c04
parentf1cdd93517c8c7f2ed5956962c7e41528c063b1e (diff)
downloadffmpeg-a2b234b917bf15fd0f60c131b801f0f84bf14ef4.tar.gz
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@niedermayer.cc> (cherry picked from commit 115fb6d03ef6310732b42258d8c3cd1839cfb74b) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/aviobuf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 392b369a78..5dda200a3b 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);