commit e4827b0c4048718ab06670cf60ef68d028fe7fc4 from: NRK via: Hiltjo Posthuma date: Sat Apr 16 14:21:01 2022 UTC drw_text: don't segfault when called with 0 width this patch just rejects *any* 0 width draws, which is surely an error by the caller. this also guards against cases where the width is too small for the ellipsis to fit, so ellipsis_w will remain 0. reported by Bakkeby commit - e73651f12a406629778f02d8e5acbe2caec0dfc2 commit + e4827b0c4048718ab06670cf60ef68d028fe7fc4 blob - a50c9ee0545db977ab4b9afbe49955cdddddbda4 blob + 2f3a5df25b01e6438d2531add938157cd1561d50 --- drw.c +++ drw.c @@ -267,7 +267,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsig enum { nomatches_len = 64 }; static struct { long codepoint[nomatches_len]; unsigned int idx; } nomatches; - if (!drw || (render && !drw->scheme) || !text || !drw->fonts) + if (!drw || (render && (!drw->scheme || !w)) || !text || !drw->fonts) return 0; if (!render) {