diff options
author | Laurent Aimar <fenrir@videolan.org> | 2011-09-24 16:16:39 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-09-25 15:04:58 +0200 |
commit | d1186ff72d75b6067770890758c4feb92abd84f7 (patch) | |
tree | 088d3a26f47f92a219e0afce9148767960d31f4f /libavcodec | |
parent | a246cefa75aed2ade315d6d09068aacb6b0fe76b (diff) | |
download | ffmpeg-d1186ff72d75b6067770890758c4feb92abd84f7.tar.gz |
h264: check for out of bounds reads in ff_h264_decode_extradata().
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/h264.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 9889224abd..e5d0ed8660 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1005,6 +1005,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; @@ -1015,6 +1017,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; |