text-freetype2: Fix undefined behavior for alpha > 127
Found via UBSan, actual (sample) error: "plugins/text-freetype2/text-functionality.c:284:26: runtime error: left shift of 194 by 24 places cannot be represented in type 'int'"master
parent
41c32fd6b6
commit
78ad3ec132
|
@ -281,7 +281,7 @@ void cache_glyphs(struct ft2_source *srcdata, wchar_t *cache_glyphs)
|
|||
for (uint32_t x = 0; x < g_w; x++) {
|
||||
alpha = slot->bitmap.buffer[glyph_pos];
|
||||
srcdata->texbuf[buf_pos] =
|
||||
0x00FFFFFF ^ (alpha << 24);
|
||||
0x00FFFFFF ^ ((uint32_t)alpha << 24);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue