[hackers] [libsl] Avoid unsigned integer underflow in drw_text() || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Wed, 30 Oct 2024 12:52:59 +0100 (CET)

commit 206fe9b99f01604b10e6d8e5ab52a035712476f0
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Wed Oct 30 13:03:56 2024 +0100
Commit: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
CommitDate: Wed Oct 30 13:03:56 2024 +0100

    Avoid unsigned integer underflow in drw_text()
    
    Patch by Raymond Cole <rc_AT_wolog.xyz>, thanks

diff --git a/drw.c b/drw.c
index 344de61..c41e6af 100644
--- a/drw.c
+++ b/drw.c
_AT_@ -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));
Received on Wed Oct 30 2024 - 12:52:59 CET

This archive was generated by hypermail 2.3.0 : Wed Oct 30 2024 - 13:00:45 CET