summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2019-10-16 16:06:06 -0400
committerAdam Jackson <ajax@redhat.com>2019-10-16 16:06:06 -0400
commitad0fe6b6f9600600663bd1cd0f47ce5c6feefdf3 (patch)
treead7708c321058b00da4ae8e406675a2760821ae8 /shared
parent3c3f3b1cc3c30c646795668662c3234656135cd2 (diff)
downloadweston-ad0fe6b6f9600600663bd1cd0f47ce5c6feefdf3.tar.gz
image-loader: Fix undefined left shift in premultiply_data
../shared/image-loader.c:184:14: runtime error: left shift of 255 by 24 places cannot be represented in type 'int' Store each channel in a uint32_t instead of a byte so we compute the shift over an unsigned type.
Diffstat (limited to 'shared')
-rw-r--r--shared/image-loader.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/shared/image-loader.c b/shared/image-loader.c
index 8686e02a..2385c7a0 100644
--- a/shared/image-loader.c
+++ b/shared/image-loader.c
@@ -166,15 +166,15 @@ premultiply_data(png_structp png,
png_bytep p;
for (i = 0, p = data; i < row_info->rowbytes; i += 4, p += 4) {
- png_byte alpha = p[3];
+ uint32_t alpha = p[3];
uint32_t w;
if (alpha == 0) {
w = 0;
} else {
- png_byte red = p[0];
- png_byte green = p[1];
- png_byte blue = p[2];
+ uint32_t red = p[0];
+ uint32_t green = p[1];
+ uint32_t blue = p[2];
if (alpha != 0xff) {
red = multiply_alpha(alpha, red);