hi folks,

i found a bug in st (latest git):

if you keep downsizing your fontsize until either xw.ch or xw.cw gets 0, st crashes, because there is an unchecked division in cresize. my patch fixes the problem, but i haven't checked for a better solution.

nils


diff --git a/st.c b/st.c
index 1deb7bc..5403d29 100644
--- a/st.c
+++ b/st.c
@@ -3815,8 +3815,8 @@ cresize(int width, int height) {
        if(height != 0)
                xw.h = height;

-       col = (xw.w - 2 * borderpx) / xw.cw;
-       row = (xw.h - 2 * borderpx) / xw.ch;
+       col = (xw.w - 2 * borderpx) / (xw.cw ? xw.cw : 1);
+       row = (xw.h - 2 * borderpx) / (xw.ch ? xw.ch : 1);

        tresize(col, row);
        xresize(col, row);

Reply via email to