[dev] [lsw][bug] segfault after querying window with no children

From: Augusto Castelo <alpheratz99_AT_protonmail.com>
Date: Sat, 25 Jun 2022 01:50:17 +0000

Hi,

lsw crashes with a segfault when you pass a window id of a window with no children.

I spotted the problem, at line 39 of lsw.c; XQueryTree isn't failing but is setting `n` (children count (unsigned int)) to 0, later on `n` is used to loop throgh the children, in the first iteration &wins[n-1] >= &wins[0] is true when `n` is equal to 0 (because n-1 will evaluate to UINT_MAX) and then calling XGetWindowAttributes on that address produces a segfault.

lsw-version: 0.3
lsw-commit-hash: 4d6e1b3

Cheers!
Received on Sat Jun 25 2022 - 03:50:17 CEST

This archive was generated by hypermail 2.3.0 : Sat Jun 25 2022 - 04:00:08 CEST