summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorBen Boeckel <mathstuf@gmail.com>2014-09-14 14:36:49 -0400
committerwm4 <wm4@nowhere>2014-09-14 21:10:09 +0200
commit9bfa38add66df3ebbeb2c8e0ead778a8356dbe54 (patch)
tree473cab70b2a5ba9b38f504bef80e18c61dc334f1 /sub
parent3f6212cd8d2d8a86bb913d00463620cd2abbc8d9 (diff)
downloadmpv-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')
-rw-r--r--sub/img_convert.c8
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;