Commit 868f5b89 authored by Thomas Guillem's avatar Thomas Guillem Committed by Jean-Baptiste Kempf

swscale: fix memory corruption when i_extend_factor != 1

This led to a random crash when resizing video on a small display (or when
resizing small video).
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent bff20615
...@@ -561,7 +561,7 @@ static void CopyPad( picture_t *p_dst, const picture_t *p_src ) ...@@ -561,7 +561,7 @@ static void CopyPad( picture_t *p_dst, const picture_t *p_src )
const plane_t *s = &p_src->p[n]; const plane_t *s = &p_src->p[n];
plane_t *d = &p_dst->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 ) 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 ); 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 );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment