[vlc-commits] SDL_image: Fix unaligned and potentially out of bound access
Hugo Beauzée-Luyssen
git at videolan.org
Tue Apr 7 11:13:15 CEST 2020
vlc/vlc-3.0 | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Nov 22 12:28:57 2019 +0100| [624b49b2e1f930e027195488d999ee4c8638c6e0] | committer: Hugo Beauzée-Luyssen
SDL_image: Fix unaligned and potentially out of bound access
SDL_image allocates an unpadded buffer of height * pitch, causing the
access to the last pixel to be one byte out of bounds
(cherry picked from commit e7c0a1e481d843588be88a23554369c48aaa9c67)
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=624b49b2e1f930e027195488d999ee4c8638c6e0
---
modules/codec/sdl_image.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/modules/codec/sdl_image.c b/modules/codec/sdl_image.c
index 65a1223e1a..76290dbd1a 100644
--- a/modules/codec/sdl_image.c
+++ b/modules/codec/sdl_image.c
@@ -224,7 +224,9 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
for ( int j = 0; j < p_surface->w; j++ )
{
uint8_t r, g, b;
- SDL_GetRGB( *(uint32_t*)p_src, p_surface->format,
+ uint32_t pixel = 0;
+ memcpy(&pixel, p_src, 3);
+ SDL_GetRGB( pixel, p_surface->format,
&r, &g, &b );
*(p_dst++) = r;
*(p_dst++) = g;
More information about the vlc-commits
mailing list