diff options
author | Ben Boeckel <mathstuf@gmail.com> | 2014-09-14 14:36:49 -0400 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-09-14 21:10:09 +0200 |
commit | 9bfa38add66df3ebbeb2c8e0ead778a8356dbe54 (patch) | |
tree | 473cab70b2a5ba9b38f504bef80e18c61dc334f1 /sub/img_convert.c | |
parent | 3f6212cd8d2d8a86bb913d00463620cd2abbc8d9 (diff) | |
download | mpv-9bfa38add66df3ebbeb2c8e0ead778a8356dbe54.tar.bz2 mpv-9bfa38add66df3ebbeb2c8e0ead778a8356dbe54.tar.xz |
img_convert: sanitizer: avoid invalid left-shifts
(a << 24) is not in the valid int range when a is 255, so use an
unsigned instead.
Signed-off-by: wm4 <wm4@nowhere>
Diffstat (limited to 'sub/img_convert.c')
-rw-r--r-- | sub/img_convert.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sub/img_convert.c b/sub/img_convert.c index a29db4a6f2..2094e98086 100644 --- a/sub/img_convert.c +++ b/sub/img_convert.c @@ -46,10 +46,10 @@ static void rgba_to_premultiplied_rgba(uint32_t *colors, size_t count) { for (int n = 0; n < count; n++) { uint32_t c = colors[n]; - int b = c & 0xFF; - int g = (c >> 8) & 0xFF; - int r = (c >> 16) & 0xFF; - int a = (c >> 24) & 0xFF; + unsigned b = c & 0xFF; + unsigned g = (c >> 8) & 0xFF; + unsigned r = (c >> 16) & 0xFF; + unsigned a = (c >> 24) & 0xFF; b = b * a / 255; g = g * a / 255; r = r * a / 255; |