summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}