[vlc-commits] swscale: avoid invalid pointer conversion

Rémi Denis-Courmont git at videolan.org
Sun Mar 3 10:25:05 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Mar  3 09:59:10 2019 +0200| [ab00e6c59d42e05ab08893091783d8b5febc0058] | committer: Rémi Denis-Courmont

swscale: avoid invalid pointer conversion

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

 modules/video_chroma/swscale.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/modules/video_chroma/swscale.c b/modules/video_chroma/swscale.c
index 2b1060b8ca..fd254bdcdc 100644
--- a/modules/video_chroma/swscale.c
+++ b/modules/video_chroma/swscale.c
@@ -589,8 +589,9 @@ static void Convert( filter_t *p_filter, struct SwsContext *ctx,
 {
     filter_sys_t *p_sys = p_filter->p_sys;
     uint8_t palette[AVPALETTE_SIZE];
-    uint8_t *src[4]; int src_stride[4];
-    uint8_t *dst[4]; int dst_stride[4];
+    uint8_t *src[4], *dst[4];
+    const uint8_t *csrc[4];
+    int src_stride[4], dst_stride[4];
 
     GetPixels( src, src_stride, p_sys->desc_in, &p_filter->fmt_in.video,
                p_src, i_plane_count, b_swap_uvi );
@@ -607,11 +608,14 @@ static void Convert( filter_t *p_filter, struct SwsContext *ctx,
     GetPixels( dst, dst_stride, p_sys->desc_out, &p_filter->fmt_out.video,
                p_dst, i_plane_count, b_swap_uvo );
 
+    for (size_t i = 0; i < ARRAY_SIZE(src); i++)
+        csrc[i] = src[i];
+
 #if LIBSWSCALE_VERSION_INT  >= ((0<<16)+(5<<8)+0)
-    sws_scale( ctx, src, src_stride, 0, i_height,
+    sws_scale( ctx, csrc, src_stride, 0, i_height,
                dst, dst_stride );
 #else
-    sws_scale_ordered( ctx, src, src_stride, 0, i_height,
+    sws_scale_ordered( ctx, csrc, src_stride, 0, i_height,
                        dst, dst_stride );
 #endif
 }



More information about the vlc-commits mailing list