diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-11-25 14:45:30 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-06-10 02:13:06 +0200 |
commit | 42b0ef9056e7b47b5931e6f3f7313a830c160086 (patch) | |
tree | 09a2a2a4dcb7cc571235c9e551b8b6b15afbee46 /libavcodec/utils.c | |
parent | 1e18ed781f8befcb72f94a1bd4d5392c2e7e6267 (diff) | |
download | ffmpeg-42b0ef9056e7b47b5931e6f3f7313a830c160086.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/utils.c')
-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 5326f19f04..56258ebd22 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -3215,6 +3215,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 |