[vlc-commits] codec: avcodec: fix broken check before copy (fix #22240)

Francois Cartegnie git at videolan.org
Wed Jul 17 13:24:24 CEST 2019


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon May 20 14:27:39 2019 +0200| [2b4f9d0b0e0861f262c90e9b9b94e7d53b864509] | committer: Hugo Beauzée-Luyssen

codec: avcodec: fix broken check before copy (fix #22240)

copy parameters are the picture ones

regression by c988b8d58b01ef6d628e3051774a2032dd7f6b7d

(cherry picked from commit 603ecaf0f3fdf3b0a83cd2c773e05ac347b2149a)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=2b4f9d0b0e0861f262c90e9b9b94e7d53b864509
---

 modules/codec/avcodec/video.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 097e7cb11a..c5899fd736 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -364,8 +364,9 @@ static int lavc_CopyPicture(decoder_t *dec, picture_t *pic, AVFrame *frame)
                 sys->p_context->pix_fmt, (name != NULL) ? name : "unknown");
         return VLC_EGENERIC;
     } else if (fourcc != pic->format.i_chroma
-     || frame->width > (int) pic->format.i_width
-     || frame->height > (int) pic->format.i_height)
+     /* ensure we never read more than dst lines/pixels from src */
+     || frame->width != (int) pic->format.i_visible_width
+     || frame->height < (int) pic->format.i_visible_height)
     {
         msg_Warn(dec, "dropping frame because the vout changed");
         return VLC_EGENERIC;



More information about the vlc-commits mailing list