termptyesc: avoid issue with integer promotion
Found by UBSan: sgr-truecolors.sh... ../src/bin/termptyesc.c:737:35: runtime error: left shift of 244 by 24 places cannot be represented in type 'int' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/bin/termptyesc.c:737:35 in
This commit is contained in:
parent
f9b6f88be1
commit
00c427a20f
|
@ -734,7 +734,10 @@ _approximate_truecolor_rgb(Termpty *ty, int r0, int g0, int b0)
|
|||
int c;
|
||||
int distance_min = INT_MAX;
|
||||
Evas_Object *textgrid;
|
||||
const uint32_t color_msb = (r0 << 24) | (g0 << 16) | (b0 << 8);
|
||||
const uint32_t color_msb = 0
|
||||
| (((uint8_t)r0) << 24)
|
||||
| (((uint8_t)g0) << 16)
|
||||
| (((uint8_t)b0) << 8);
|
||||
|
||||
if (_tcc_find(color_msb, &chosen_color))
|
||||
return chosen_color;
|
||||
|
|
Loading…
Reference in New Issue