]> git.sesse.net Git - vlc/commitdiff
swscale: fix memory corruption when i_extend_factor != 1
authorThomas Guillem <thomas@gllm.fr>
Tue, 16 Dec 2014 12:02:27 +0000 (12:02 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 17 Dec 2014 14:13:04 +0000 (15:13 +0100)
This led to a random crash when resizing video on a small display (or when
resizing small video).

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/video_chroma/swscale.c

index c53cce5906778e740bfaf539628ee0db25f40306..c99e5696aa04372294d37cc11b5c68a91b487ec7 100644 (file)
@@ -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 );