diff options
author | NRK <nrk@disroot.org> | 2022-03-28 01:02:52 +0600 |
---|---|---|
committer | rafa_99 <raroma09@gmail.com> | 2022-04-16 15:45:31 +0100 |
commit | 58f912acb5daeb77222f5c1cf860ee29d9a53c5e (patch) | |
tree | 02aa1a3058974c67758eb63a8eb70fe13eaf1f56 | |
parent | 8877bc60f7e6cab133cbf780c3dcae69648a195c (diff) |
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 <bakkeby@gmail.com>
-rw-r--r-- | drw.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -267,7 +267,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp 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) { |