[FFmpeg-cvslog] swscale: fix some undefined signed left shifts

Justin Ruggles git at videolan.org
Sun Apr 13 01:41:15 CEST 2014


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Sat Apr  5 14:46:22 2014 -0400| [20c38c9c18b75e62f6c489d9b95bea88efdf3915] | committer: Justin Ruggles

swscale: fix some undefined signed left shifts

Based on a patch by Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=20c38c9c18b75e62f6c489d9b95bea88efdf3915
---

 libswscale/swscale_unscaled.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index daa6f5f..9e50d48 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -1230,13 +1230,13 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
 #if HAVE_BIGENDIAN
             case AV_PIX_FMT_BGR24:
 #endif
-                c->pal_rgb[i] = (r + (g << 8) + (b << 16)) << 8;
+                c->pal_rgb[i] = (r << 8) + (g << 16) + ((unsigned)b << 24);
                 break;
             case AV_PIX_FMT_RGB32_1:
 #if HAVE_BIGENDIAN
             case AV_PIX_FMT_RGB24:
 #endif
-                c->pal_rgb[i] = (b + (g << 8) + (r << 16)) << 8;
+                c->pal_rgb[i] = (b << 8) + (g << 16) + ((unsigned)r << 24);
                 break;
             case AV_PIX_FMT_RGB32:
 #if !HAVE_BIGENDIAN



More information about the ffmpeg-cvslog mailing list