aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-25 14:45:30 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-30 21:40:36 +0100
commit991a2034796b18012f65b53e6bb8ce521c881a36 (patch)
tree0e715228d9212bc1e2f93d20166ed2bd2acca29c /libavcodec
parent8524009161b0430ba961a4e6fcd8125a695edd7c (diff)
downloadffmpeg-991a2034796b18012f65b53e6bb8ce521c881a36.tar.gz
avcodec/utils: Check that the data is complete in avpriv_bprint_to_extradata()
Fixes out of array read Fixes: asan_heap-oob_4d2250_814_cov_2745172097_JACOsub_capability_tester.jss Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 3d5d95db3f5d8e2093e9e19d0c46e86f54ed2a5d) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/utils.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index ca6fe2d8e4..4e95ab039a 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -3610,6 +3610,11 @@ int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf)
ret = av_bprint_finalize(buf, &str);
if (ret < 0)
return ret;
+ if (!av_bprint_is_complete(buf)) {
+ av_free(str);
+ return AVERROR(ENOMEM);
+ }
+
avctx->extradata = str;
/* Note: the string is NUL terminated (so extradata can be read as a
* string), but the ending character is not accounted in the size (in