[vlc-devel] [PATCH] swscale: fix memory corruption when i_extend_factor != 1

Thomas Guillem thomas at gllm.fr
Tue Dec 16 14:02:27 CET 2014


This led to a random crash when resizing video on a small display (or when
resizing small video).
---
 modules/video_chroma/swscale.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/video_chroma/swscale.c b/modules/video_chroma/swscale.c
index c53cce5..c99e569 100644
--- a/modules/video_chroma/swscale.c
+++ b/modules/video_chroma/swscale.c
@@ -561,7 +561,7 @@ static void CopyPad( picture_t *p_dst, const picture_t *p_src )
         const plane_t *s = &p_src->p[n];
         plane_t *d = &p_dst->p[n];
 
-        for( int y = 0; y < s->i_lines; y++ )
+        for( int y = 0; y < s->i_lines && y < d->i_lines; y++ )
         {
             for( int x = s->i_visible_pitch; x < d->i_visible_pitch; x += s->i_pixel_pitch )
                 memcpy( &d->p_pixels[y*d->i_pitch + x], &d->p_pixels[y*d->i_pitch + s->i_visible_pitch - s->i_pixel_pitch], s->i_pixel_pitch );
-- 
2.1.3




More information about the vlc-devel mailing list