mesa uses of atof to parse glxserverversion harmfull for any of the non english sessions
Submitted by Alban Browaeys
Assigned to Ian Romanick
Description
Created attachment 42563 workaround atof behing feed non localized data thus preventing glx 1.4 codepath use
In src/glx/glxext.c at least for french users if (atof(priv->serverGLXversion) >= 1.3) { always leads to false as priv->serverGLXVersion is "1.4" etc and in locales that uses comma as the decimal separator instead of dot as for english speakers "1.4" becomes "1" via atof instead of 1.4 the double.
I made a small hack using setlocale to set LC_ALL to C before atof call and restore it afterwards. We may not want to bail out if the saved_locale is null (out of memory).
I have been told other places uses atof in mesa, the others places that does so with the same string (serverGLXVersion) is: src/gallium/state_trackers/egl/x11/glxinit.c
I do not know if the other are feed with data localized or need to be protected like the previous ones.
Patch 42563, "workaround atof behing feed non localized data thus preventing glx 1.4 codepath use":
0001-locale-to-C-for-atof-in-glxext.c.txt
Version: git