In case the hw frames context does not return way too large frames,
but slightly smaller ones(for example height being 1080, while
coded_height is 1088), this causes failures because various code will
try to read/write beyond the frame size.
---
 libavcodec/decode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index a7f1e23fc2..0a5ec6a21b 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1491,8 +1491,8 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, 
AVFrame *frame, int flags
 
     if (avctx->hw_frames_ctx) {
         ret = av_hwframe_get_buffer(avctx->hw_frames_ctx, frame, 0);
-        frame->width  = avctx->coded_width;
-        frame->height = avctx->coded_height;
+        frame->width  = FFMIN(avctx->coded_width, frame->width);
+        frame->height = FFMIN(avctx->coded_height, frame->height);
         return ret;
     }
 
-- 
2.14.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to