[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master e9e5d0ba73: Fix BadValue crash when looking up empty color names
From: |
Po Lu |
Subject: |
master e9e5d0ba73: Fix BadValue crash when looking up empty color names on some X servers |
Date: |
Thu, 20 Jan 2022 22:40:54 -0500 (EST) |
branch: master
commit e9e5d0ba7342f709080090857d9d37ea07a49c81
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Fix BadValue crash when looking up empty color names on some X servers
* src/xterm.c (x_parse_color): Avoid parsing empty color names.
---
src/xterm.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/xterm.c b/src/xterm.c
index 5adbf210be..a53f2982c6 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2789,8 +2789,9 @@ x_query_frame_background_color (struct frame *f, XColor
*bgcolor)
and names we've actually looked up; list-colors-display is probably
the most color-intensive case we're likely to hit. */
-Status x_parse_color (struct frame *f, const char *color_name,
- XColor *color)
+Status
+x_parse_color (struct frame *f, const char *color_name,
+ XColor *color)
{
/* Don't pass #RGB strings directly to XParseColor, because that
follows the X convention of zero-extending each channel
@@ -2819,6 +2820,10 @@ Status x_parse_color (struct frame *f, const char
*color_name,
}
}
+ /* Some X servers send BadValue on empty color names. */
+ if (!strlen (color_name))
+ return 0;
+
if (XParseColor (dpy, cmap, color_name, color) == 0)
/* No caching of negative results, currently. */
return 0;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master e9e5d0ba73: Fix BadValue crash when looking up empty color names on some X servers,
Po Lu <=