1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-22 06:42:03 +00:00

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>
This commit is contained in:
Ben Boeckel 2014-09-14 14:36:49 -04:00 committed by wm4
parent 3f6212cd8d
commit 9bfa38add6

View File

@ -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;