From: Nikita Popov Date: Wed, 19 Jun 2019 14:42:17 +0000 (+0200) Subject: Suppress shift UB in gd_itofx() X-Git-Tag: php-7.4.0alpha2~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b3b07cd26b85ff0f9c0872ef1271dfc76a2efff;p=php Suppress shift UB in gd_itofx() There doesn't seem to be a corresponding upstream fix for this. --- diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c index 357cfa47bd..1ac67a9d12 100644 --- a/ext/gd/libgd/gd_interpolation.c +++ b/ext/gd/libgd/gd_interpolation.c @@ -91,7 +91,7 @@ TODO: part of GD */ typedef long gdFixed; /* Integer to fixed point */ -#define gd_itofx(x) ((x) << 8) +#define gd_itofx(x) (long)((unsigned long)(x) << 8) /* Float to fixed point */ #define gd_ftofx(x) (long)((x) * 256) @@ -112,7 +112,7 @@ typedef long gdFixed; #define gd_mulfx(x,y) (((x) * (y)) >> 8) /* Divide a fixed by a fixed */ -#define gd_divfx(x,y) (((x) << 8) / (y)) +#define gd_divfx(x,y) ((long)((unsigned long)(x) << 8) / (y)) typedef struct {