Avoid unsigned integer underflow in drw_text() - libsl - shared code master of various suckless projects
 (HTM) git clone git://git.suckless.org/libsl
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 206fe9b99f01604b10e6d8e5ab52a035712476f0
 (DIR) parent 93a43d03b00ddf8757636b69ad24d2f5de3336da
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Wed, 30 Oct 2024 13:03:56 +0100
       
       Avoid unsigned integer underflow in drw_text()
       
       Patch by Raymond Cole <rc@wolog.xyz>, thanks
       
       Diffstat:
         M drw.c                               |       2 ++
       
       1 file changed, 2 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git 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));