diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-11-25 14:45:30 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-01-06 18:25:50 +0100 |
commit | 494d3d14dbff87dbdc1b79154deef96b96246d87 (patch) | |
tree | 37030a330a652d68f9c8ae31db3a34376e71b563 | |
parent | 6c63eb59099e7096aaaaaad3c15a1dab62afc87b (diff) | |
download | ffmpeg-494d3d14dbff87dbdc1b79154deef96b96246d87.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>
-rw-r--r-- | libavcodec/utils.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 85d614a028..a30b6d9d39 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -3601,6 +3601,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 |