aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Simonsen <bo@geekworld.dk>2020-04-14 18:42:38 (GMT)
committerMathias Gumz <akira@fluxbox.org>2020-04-19 12:55:44 (GMT)
commit419170668a365625ed61d5c6aa83541c0778446f (patch)
tree824ee2eece00faf769755a5cc094ac0dc16bf845
parentf48237e3ade27dbf69c1e87b80224445d50b1763 (diff)
downloadfluxbox-419170668a365625ed61d5c6aa83541c0778446f.zip
fluxbox-419170668a365625ed61d5c6aa83541c0778446f.tar.bz2
Handle sizehint base_width / base_height being less than 0
Some applications supply -1 in base_width / base_height. One example is the Preferences dialog of pcmanfm-qt: WM_NORMAL_HINTS(WM_SIZE_HINTS): ... program specified base size: -1 by -1 Without this commit the program will crash due to overflow of unsigned int.
-rw-r--r--src/WindowState.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/WindowState.cc b/src/WindowState.cc
index e684992..4bd8f61 100644
--- a/src/WindowState.cc
+++ b/src/WindowState.cc
@@ -113,8 +113,9 @@ void SizeHints::reset(const XSizeHints &sizehint) {
113 min_width = min_height = 1; 113 min_width = min_height = 1;
114 114
115 if (sizehint.flags & PBaseSize) { 115 if (sizehint.flags & PBaseSize) {
116 base_width = sizehint.base_width; 116 base_width = std::max(sizehint.base_width, 0);
117 base_height = sizehint.base_height; 117 base_height = std::max(sizehint.base_height, 0);
118
118 if (!(sizehint.flags & PMinSize)) { 119 if (!(sizehint.flags & PMinSize)) {
119 min_width = base_width; 120 min_width = base_width;
120 min_height = base_height; 121 min_height = base_height;