bbidulock / blackboxwm

A window manager for X11
Other
167 stars 28 forks source link

segfaults when fonts aren't found #28

Open stainless81 opened 4 years ago

stainless81 commented 4 years ago

Please forgive me if my github etiquette is lacking. This is my first time filing an issue.

With version 0.76 there seems to be some problems if fonts are missing.

In Font.cc on lines 450 and 462, if the font specified in the style file is not found, NULL pointers are dereferenced causing segfaults. Wrapping those and returning 0 if the pointers are NULL leads to another segfault.

0 0x00007effcf9671b0 in XmbTextExtents () from /usr/lib64/libX11.so.6

1 0x00000000004443b0 in bt::textRect (screen=, font=...,

text="m\000\000\000:\000\000\000m\000\000\000m\000\000\000m\000\000\000m\000\000\000 \000\000\000 \000\000\000 \000\000\000 \000\000\000m\000\000\000:\000\000\000m\000\000\000m\000\000\000m\000\000\000m\000\000\000") at Font.cc:398

2 0x0000000000414374 in BScreen::updateGeomWindow (this=0x1e8a6c0) at ../lib/Display.hh:84

3 0x000000000041ba24 in BScreen::reconfigure (this=0x1e8a6c0) at Screen.cc:522

4 0x000000000043aea0 in std::mem_fun_t<void, BScreen>::operator() (__p=, this=) at /usr/include/c++/9.3.0/bits/stl_function.h:1211

5 std::for_each<BScreen**, std::mem_fun_t<void, BScreen> > (f=..., last=0x1ea1d18, __first=0x1ea1d10) at /usr/include/c++/9.3.0/bits/stl_algo.h:3876

6 Blackbox::timeout (this=0x7ffc6f775460) at blackbox.cc:402

7 0x000000000043e457 in bt::Application::run (this=0x7ffc6f775460) at Application.cc:300

8 0x000000000040a0f8 in main (argc=1, argv=0x7ffc6f7758e8) at main.cc:167

(gdb)

The Font.cc:398 might be off a little, as I had been editing that file to check for NULL pointers, but those /should/ all be after that line leaving this one unaffected.

I was going to debug it further and hopefully be able to submit a patch, but that may be a few days off; I haven't really dug into the blackbox source since 0.65. Right now it's easier for me to make sure the right fonts are present.