summaryrefslogtreecommitdiff
path: root/libavcodec/h264_slice.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-07-08 17:49:00 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-07-08 17:50:05 +0200
commit3c63d06d81e7b4ff8f37c0a3cc344d6a80f72928 (patch)
tree662596960a21441e56e411db49bab383e94b0e0a /libavcodec/h264_slice.c
parent80e42387dc524a6c893bca3ec27d55a850af58e4 (diff)
avcodec/h264_slice: Fix container cropping
Fixes out of array read Fixes: asan_heap-oob_394322e_138_cov_4265020547_CVPCMNL1_SVA_C.264 Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264_slice.c')
-rw-r--r--libavcodec/h264_slice.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 4b6c2170d0..10a50bbfc7 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -980,7 +980,10 @@ static int init_dimensions(H264Context *h)
/* handle container cropping */
if (FFALIGN(h->avctx->width, 16) == FFALIGN(width, 16) &&
- FFALIGN(h->avctx->height, 16) == FFALIGN(height, 16)) {
+ FFALIGN(h->avctx->height, 16) == FFALIGN(height, 16) &&
+ h->avctx->width <= width &&
+ h->avctx->height <= height
+ ) {
width = h->avctx->width;
height = h->avctx->height;
}