nigels-com / glew

The OpenGL Extension Wrangler Library
Other
2.58k stars 609 forks source link

Remove broken end of string checks in _glewStrSame #361

Closed ibbem closed 2 years ago

ibbem commented 2 years ago

I think this code tried to check for a zero terminated null byte, but it actually just checked if the address of the corresponding character is non-zero, which is always true. These broken checks are simply dropped because the following code assumes that the string b doesn't include a null byte and all call sites already pass the length of the string without counting the null byte.

This bug was found by gcc 12.1 which emits a warning on this kind of code. Now glew builds without any warnings using gcc 12.1. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102103 for the corresponding issue.

nigels-com commented 2 years ago

Agreed. The checks look harmless but useless.

kopetri commented 2 years ago

Are you planing to publish these fixes in a new release any time soon? Would be nice to have these changes available via conan.io

nigels-com commented 2 years ago

Yes, it does seem about time to put out a fresh release.