[dev] [st] crash on font resize (patch inside)

From: Nils Reuße <ml_AT_hxgn.net>
Date: Sat, 14 Feb 2015 22:55:26 +0100

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
_AT_@ -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);
Received on Sat Feb 14 2015 - 22:55:26 CET

This archive was generated by hypermail 2.3.0 : Sat Feb 14 2015 - 23:00:10 CET