[FFmpeg-cvslog] h264: check for out of bounds reads in ff_h264_decode_extradata().
Laurent Aimar
git at videolan.org
Mon Mar 19 05:30:20 CET 2012
ffmpeg | branch: release/0.8 | Laurent Aimar <fenrir at videolan.org> | Sat Sep 24 16:16:39 2011 +0200| [ec2a1d91e216c30a1e286b2141eaabe64a0296f5] | committer: Reinhard Tartler
h264: check for out of bounds reads in ff_h264_decode_extradata().
Signed-off-by: Anton Khirnov <anton at khirnov.net>
(cherry picked from commit d1186ff72d75b6067770890758c4feb92abd84f7)
Signed-off-by: Anton Khirnov <anton at khirnov.net>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ec2a1d91e216c30a1e286b2141eaabe64a0296f5
---
libavcodec/h264.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 75075f6..276ace2 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1032,6 +1032,8 @@ int ff_h264_decode_extradata(H264Context *h)
p += 6;
for (i = 0; i < cnt; i++) {
nalsize = AV_RB16(p) + 2;
+ if (p - avctx->extradata + nalsize > avctx->extradata_size)
+ return -1;
if(decode_nal_units(h, p, nalsize) < 0) {
av_log(avctx, AV_LOG_ERROR, "Decoding sps %d from avcC failed\n", i);
return -1;
@@ -1042,6 +1044,8 @@ int ff_h264_decode_extradata(H264Context *h)
cnt = *(p++); // Number of pps
for (i = 0; i < cnt; i++) {
nalsize = AV_RB16(p) + 2;
+ if (p - avctx->extradata + nalsize > avctx->extradata_size)
+ return -1;
if (decode_nal_units(h, p, nalsize) < 0) {
av_log(avctx, AV_LOG_ERROR, "Decoding pps %d from avcC failed\n", i);
return -1;
More information about the ffmpeg-cvslog
mailing list