changeset 27596:33b8ad99fbcb

Fix segfault with rgb24 and full_internal_chroma due to non-existing alpha byte being written after the array.
author michael
date Tue, 16 Sep 2008 03:49:54 +0000
parents 270f30427fcd
children 62db90e27a63
files libswscale/swscale.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/swscale.c	Tue Sep 16 02:43:02 2008 +0000
+++ b/libswscale/swscale.c	Tue Sep 16 03:49:54 2008 +0000
@@ -905,29 +905,34 @@
 {
     int i;
     int step= fmt_depth(c->dstFormat)/8;
+    int aidx= 3;
 
     switch(c->dstFormat){
     case PIX_FMT_ARGB:
         dest++;
+        aidx= 0;
     case PIX_FMT_RGB24:
+        aidx--;
     case PIX_FMT_RGBA:
         YSCALE_YUV_2_RGBX_FULL_C(1<<21)
+            dest[aidx]= 0;
             dest[0]= R>>22;
             dest[1]= G>>22;
             dest[2]= B>>22;
-            dest[3]= 0;
             dest+= step;
         }
         break;
     case PIX_FMT_ABGR:
         dest++;
+        aidx= 0;
     case PIX_FMT_BGR24:
+        aidx--;
     case PIX_FMT_BGRA:
         YSCALE_YUV_2_RGBX_FULL_C(1<<21)
+            dest[aidx]= 0;
             dest[0]= B>>22;
             dest[1]= G>>22;
             dest[2]= R>>22;
-            dest[3]= 0;
             dest+= step;
         }
         break;