all repos — fluxbox @ 8d0fb85bbc8eb1267f934873ddee285b0eb3f5f1

custom fork of the fluxbox windowmanager

be aware of badly specified _NET_WM_ICONS
Mathias Gumz akira at fluxbox dot org
commit

8d0fb85bbc8eb1267f934873ddee285b0eb3f5f1

parent

68bf9796e8d371d5824b2bd04a07db22d97b35e6

1 files changed, 17 insertions(+), 4 deletions(-)

jump to
M src/Ewmh.ccsrc/Ewmh.cc

@@ -109,10 +109,15 @@ nr_icon_data = nr_bytes_left / sizeof(CARD32);

// read all the icons stored in _NET_WM_ICON if (raw_data) - XFree(raw_data); - winclient.property(net_wm_icon, 0L, nr_icon_data, False, XA_CARDINAL, + XFree(raw_data); + + // something went wrong + if (!winclient.property(net_wm_icon, 0L, nr_icon_data, False, XA_CARDINAL, &rtype, &rfmt, &nr_read, &nr_bytes_left, - reinterpret_cast<unsigned char**>(&raw_data)); + reinterpret_cast<unsigned char**>(&raw_data))) { + + return; + } } IconContainer icon_data; // stores all available data, sorted by size (width x height)

@@ -121,10 +126,18 @@ int height;

// analyze the available icons long i; - for (i = 0; i < nr_icon_data; i += width * height ) { + + for (i = 0; i + 2 < nr_icon_data; i += width * height ) { width = raw_data[i++]; height = raw_data[i++]; + + // strange values stored in the NETWM_ICON + if (width <= 0 || height <= 0 || i + width * height > nr_icon_data) { + std::cerr << "Ewmh.cc extractNetWmIcon found strange _NET_WM_ICON dimensions for " << winclient.title() << "\n"; + XFree(raw_data); + return; + } icon_data[Size(width, height)] = &raw_data[i]; }