From 9b3b07cd26b85ff0f9c0872ef1271dfc76a2efff Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 19 Jun 2019 16:42:17 +0200 Subject: [PATCH] Suppress shift UB in gd_itofx() There doesn't seem to be a corresponding upstream fix for this. --- ext/gd/libgd/gd_interpolation.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 { -- 2.50.1