Summary: | mesa uses of atof to parse glxserverversion harmfull for any of the non english sessions | ||
---|---|---|---|
Product: | Mesa | Reporter: | Alban Browaeys <prahal> |
Component: | GLX | Assignee: | Ian Romanick <idr> |
Status: | RESOLVED MOVED | QA Contact: | |
Severity: | major | ||
Priority: | medium | ||
Version: | git | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: |
workaround atof behing feed non localized data thus preventing glx 1.4 codepath use
Avoid atof to parse non localized glx server version avoid atof with a wrapper to handle non localized input |
Description
Alban Browaeys
2011-01-26 14:48:56 UTC
I'm guessing we should port the strtof wrapper from mesa imports.h and use that. Created attachment 43013 [details] [review] Avoid atof to parse non localized glx server version The location and the name are far stretched (I do not know where to lay down this function so I added it to glx and made it available through GL/glimports.h . Looks weird though I add no clue). So here is a patch. This part of the patch confuses me: @@ -526,21 +529,26 @@ getFBConfigs(__GLXscreenConfigs *psc, __GLXdisplayPrivate *priv, int screen) LockDisplay(dpy); psc->configs = NULL; - if (atof(priv->serverGLXversion) >= 1.3) { - GetReq(GLXGetFBConfigs, fb_req); - fb_req->reqType = priv->majorOpcode; [snip] + number = (GLfloat) _GLstrtof(priv->serverGLXversion, &end); + if (end && end > priv->serverGLXversion) { + if (atof(priv->serverGLXversion) >= 1.3) { + GetReq(GLXGetFBConfigs, fb_req); + fb_req->reqType = priv->majorOpcode; Why is it necessary to call _GLstrtof and atof? The documentation for strtof, on which _GLstrtof is based, says: If no conversion is performed, zero is returned and the value of nptr is stored in the location referenced by endptr. This is the same assumption that the old atof code makes. We either get the GLX version or, in the case of a malformed string, 0.0. In any case where the value is less than 1.3, we use the GLX 1.2 protocol. Unless I've missed something (possible), it should be safe to replace the existing call to atof with a call to the new _GLstrtof. Also, I think it's better to call the new function __glXStrtof. This matches the naming convention of other internal GLX functions. Created attachment 43222 [details] [review] avoid atof with a wrapper to handle non localized input thank you for the review . I changed the name and fixed the garbage I made. I intended to use "number" not the previous atof function. -- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/74. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.