[gdk-pixbuf] gif: Preventing undefined behaviour by making left shift unsigned



commit ced897e6c5d642341f49cf45f55e7524e04fa122
Author: Tobias Mueller <muelli cryptobitch de>
Date:   Wed Dec 14 10:25:19 2016 +0100

    gif: Preventing undefined behaviour by making left shift unsigned
    
    io-gif.c:509:44: runtime error: index -2 out of bounds for type 'guchar [280]'
    io-gif.c:510:44: runtime error: index -1 out of bounds for type 'guchar [280]'
    io-gif-animation.c:422:68: runtime error: left shift of 249 by 24 places cannot be represented in type 
'int'
    
    https://bugzilla.gnome.org/show_bug.cgi?id=778584

 gdk-pixbuf/io-gif-animation.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gdk-pixbuf/io-gif-animation.c b/gdk-pixbuf/io-gif-animation.c
index df39a23..6caed9d 100644
--- a/gdk-pixbuf/io-gif-animation.c
+++ b/gdk-pixbuf/io-gif-animation.c
@@ -419,7 +419,7 @@ gdk_pixbuf_gif_anim_frame_composite (GdkPixbufGifAnim *gif_anim,
                                 /* alpha gets dumped if f->composited has no alpha */
 
                                 gdk_pixbuf_fill (f->composited,
-                                                 (gif_anim->bg_red << 24) |
+                                                 ((unsigned) gif_anim->bg_red << 24) |
                                                  (gif_anim->bg_green << 16) |
                                                  (gif_anim->bg_blue << 8));
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]