about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRaymond Cole <rc@wolog.xyz>2024-10-28 00:34:55 +0000
committerHiltjo Posthuma <hiltjo@codemadness.org>2024-10-30 13:02:17 +0100
commitcfb8627a80a334f200f68c2c8f3e384313ebbaf5 (patch)
tree11fd0ed5fce347664c2bb7051857c5e5a49f858e
parentfcb2476b693ca4c40ad32c7119e27bbeb856865c (diff)
Avoid unsigned integer underflow in drw_text() HEAD master
-rw-r--r--drw.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drw.c b/drw.c
index 344de61..c41e6af 100644
--- a/drw.c
+++ b/drw.c
@@ -248,6 +248,8 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
 	} else {
 		XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
 		XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
+		if (w < lpad)
+			return x + w;
 		d = XftDrawCreate(drw->dpy, drw->drawable,
 		                  DefaultVisual(drw->dpy, drw->screen),
 		                  DefaultColormap(drw->dpy, drw->screen));