[FFmpeg-cvslog] avcodec/utils: Check that the data is complete in avpriv_bprint_to_extradata()
Michael Niedermayer
git at videolan.org
Fri Nov 28 20:02:35 CET 2014
ffmpeg | branch: release/2.1 | Michael Niedermayer <michaelni at gmx.at> | Tue Nov 25 14:45:30 2014 +0100| [126ee72e47c9d94ec674b96b541c8a921984286e] | committer: Michael Niedermayer
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 at gmx.at>
(cherry picked from commit 3d5d95db3f5d8e2093e9e19d0c46e86f54ed2a5d)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=126ee72e47c9d94ec674b96b541c8a921984286e
---
libavcodec/utils.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 7391a69..61bf567 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -3405,6 +3405,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
More information about the ffmpeg-cvslog
mailing list