mosra / magnum

Lightweight and modular C++11 graphics middleware for games and data visualization
https://magnum.graphics/
Other
4.79k stars 440 forks source link

flextGLInit null pointer dereference #535

Closed thehans closed 3 years ago

thehans commented 3 years ago

In the event that eglQueryString fails, the program crashes due to strcmp on NULL

NULL is returned on failure.

The exception occurs here: https://github.com/mosra/magnum/blob/b79bc1821902e9fd91700f0edc517b090809e19c/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp#L52

mosra commented 3 years ago

Uh oh, I was quite sure I did the check on most places, such as https://github.com/mosra/magnum/blob/b79bc1821902e9fd91700f0edc517b090809e19c/src/Magnum/Platform/Sdl2Application.cpp#L561

but missed this one. Fixing, thanks!

mosra commented 3 years ago

Should be fixed with d09e91cac8469387feb3dc0aea515d2ad1213f84, the StringView class handles construction from a null pointer gracefully.

Since I don't have any easy way to reproduce this, would be great if you could confirm it indeed fixes the problem. Thank you! :)