xmonad/X11

Uninitialized memory access in queryTree

Closed this issue · 2 comments

Wrapper around XQueryTree (i.e., queryTree) omits return status checks and unconditionally accesses return parameters. There is no guarantee that in case of an error those will be initialized, and thus it can end up accessing uninitialized memory.

One way to fix it would be to add throwIfZero. Though, given how this function is currently used (I looked at xmonad and arbtt) simply returning (0, 0, []) could be reasonable as well.

I created a small PR #57 that addresses this issue by throwing error. This
shouldn't interfere with work you have mentioned, because so far changes
suggested there don't fix this particular issue.