[MPlayer-cvslog] r38187 - in trunk: libmenu/menu.c sub/font_load_ft.c

reimar subversion at mplayerhq.hu
Wed May 27 23:25:02 EEST 2020


Author: reimar
Date: Wed May 27 23:25:01 2020
New Revision: 38187

Log:
Fix crashes due to insufficient alignment.

Images blended on top of the video via draw_alpha
need to be aligned to 16 bytes for the new SSE2
accelerated routines.
Fix the menu code to provide that 16 bytes alignment.
The menu_draw_box code was actually broken even
before the SSE2 code since it did not request the
even the 8 byte alignment even the pre-SSE2 code
already needed.

Modified:
   trunk/libmenu/menu.c
   trunk/sub/font_load_ft.c

Modified: trunk/libmenu/menu.c
==============================================================================
--- trunk/libmenu/menu.c	Tue May 26 23:33:56 2020	(r38186)
+++ trunk/libmenu/menu.c	Wed May 27 23:25:01 2020	(r38187)
@@ -745,8 +745,13 @@ void menu_draw_box(mp_image_t* mpi,unsig
   if(g < 1) g = 1;
 
   {
-    int stride = (w+7)&(~7); // round to 8
+    int stride = (w+15)&(~15); // round to 16
+#if HAVE_LOCAL_ALIGNED
+    DECLARE_ALIGNED(16, char, pic)[stride*h];
+    DECLARE_ALIGNED(16, char, pic_alpha)[stride*h];
+#else
     char pic[stride*h],pic_alpha[stride*h];
+#endif
     memset(pic,g,stride*h);
     memset(pic_alpha,alpha,stride*h);
     draw_alpha(w,h,pic,pic_alpha,stride,

Modified: trunk/sub/font_load_ft.c
==============================================================================
--- trunk/sub/font_load_ft.c	Tue May 26 23:33:56 2020	(r38186)
+++ trunk/sub/font_load_ft.c	Wed May 27 23:25:01 2020	(r38187)
@@ -107,7 +107,7 @@ static const FT_ULong osd_charcodes[OSD_
 #define f1616ToInt(x)		(((x)+0x8000)>>16)	// 16.16
 #define floatTof266(x)		((int)((x)*(1<<6)+0.5))
 
-#define ALIGN(x)                (((x)+7)&~7)    // 8 byte align
+#define ALIGN(x)                (((x)+15)&~15)    // 16 byte align
 
 #define WARNING(msg, args...)      mp_msg(MSGT_OSD, MSGL_WARN, msg "\n", ## args)
 


More information about the MPlayer-cvslog mailing list