smasherprog / screen_capture_lite

cross platform screen/window capturing library
MIT License
616 stars 156 forks source link

tolower causes *** stack smashing detected ***: terminated #94

Closed perara closed 3 years ago

perara commented 3 years ago

While in Linux environment, and having the following tab open in chrome: https://unix.stackexchange.com/questions/14159/how-do-i-find-the-window-dimensions-and-position-accurately-including-decoration I get the following error: *** stack smashing detected ***: terminated

The line is found in GetWindows.cpp:L112 std::transform(name.begin(), name.end(), std::begin(w.Name), ::tolower);

Removing this line makes the program run as expected. Is the tolower really needed anyways?. I'm assuming the special characters in the window title is causing this issue?

smasherprog commented 3 years ago

If you can issue a PR ill merge it in. The tolower isnt needed

perara commented 3 years ago

See #95 95

smasherprog commented 3 years ago

Fixed by adding bounds check. I like the fact that all the windows names are tolowered. It makes finding names a bit easier if the library forces all window names to be tolower.