forked from external/yambar
config: don’t crash (div-by-zero) if the alpha component is 0
This commit is contained in:
parent
220e43526c
commit
f49652130d
2 changed files with 4 additions and 0 deletions
|
@ -27,6 +27,7 @@
|
||||||
(https://codeberg.org/dnkl/yambar/issues/12).
|
(https://codeberg.org/dnkl/yambar/issues/12).
|
||||||
* mpd: fix compilation with clang
|
* mpd: fix compilation with clang
|
||||||
(https://codeberg.org/dnkl/yambar/issues/16).
|
(https://codeberg.org/dnkl/yambar/issues/16).
|
||||||
|
* Crash when the alpha component in a color value was 0.
|
||||||
|
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
3
config.c
3
config.c
|
@ -53,6 +53,9 @@ conf_to_color(const struct yml_node *node)
|
||||||
uint16_t blue = hex_byte(&hex[4]);
|
uint16_t blue = hex_byte(&hex[4]);
|
||||||
uint16_t alpha = hex_byte(&hex[6]);
|
uint16_t alpha = hex_byte(&hex[6]);
|
||||||
|
|
||||||
|
if (alpha == 0)
|
||||||
|
return (pixman_color_t){0, 0, 0, 0};
|
||||||
|
|
||||||
alpha |= alpha << 8;
|
alpha |= alpha << 8;
|
||||||
int alpha_div = 0xffff / alpha;
|
int alpha_div = 0xffff / alpha;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue