wined3d: Use a safer, more compliant method to parse extension strings.
This commit is contained in:
parent
7818cbda4a
commit
c8b6b2b1d8
|
@ -627,14 +627,22 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
|
||||||
ERR(" GL_Extensions returns NULL\n");
|
ERR(" GL_Extensions returns NULL\n");
|
||||||
} else {
|
} else {
|
||||||
while (*GL_Extensions != 0x00) {
|
while (*GL_Extensions != 0x00) {
|
||||||
const char *Start = GL_Extensions;
|
const char *Start;
|
||||||
char ThisExtn[256];
|
char ThisExtn[256];
|
||||||
|
size_t len;
|
||||||
|
|
||||||
memset(ThisExtn, 0x00, sizeof(ThisExtn));
|
while (isspace(*GL_Extensions)) GL_Extensions++;
|
||||||
while (*GL_Extensions != ' ' && *GL_Extensions != 0x00) {
|
Start = GL_Extensions;
|
||||||
|
while (!isspace(*GL_Extensions) && *GL_Extensions != 0x00) {
|
||||||
GL_Extensions++;
|
GL_Extensions++;
|
||||||
}
|
}
|
||||||
memcpy(ThisExtn, Start, (GL_Extensions - Start));
|
|
||||||
|
len = GL_Extensions - Start;
|
||||||
|
if (len == 0 || len >= sizeof(ThisExtn))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
memcpy(ThisExtn, Start, len);
|
||||||
|
ThisExtn[len] = '\0';
|
||||||
TRACE_(d3d_caps)("- %s\n", ThisExtn);
|
TRACE_(d3d_caps)("- %s\n", ThisExtn);
|
||||||
|
|
||||||
for (i = 0; i < (sizeof(EXTENSION_MAP) / sizeof(*EXTENSION_MAP)); ++i) {
|
for (i = 0; i < (sizeof(EXTENSION_MAP) / sizeof(*EXTENSION_MAP)); ++i) {
|
||||||
|
@ -644,8 +652,6 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*GL_Extensions == ' ') GL_Extensions++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl_info->supported[APPLE_FENCE]) {
|
if (gl_info->supported[APPLE_FENCE]) {
|
||||||
|
@ -998,22 +1004,28 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
|
||||||
ERR(" WGL_Extensions returns NULL\n");
|
ERR(" WGL_Extensions returns NULL\n");
|
||||||
} else {
|
} else {
|
||||||
while (*WGL_Extensions != 0x00) {
|
while (*WGL_Extensions != 0x00) {
|
||||||
const char *Start = WGL_Extensions;
|
const char *Start;
|
||||||
char ThisExtn[256];
|
char ThisExtn[256];
|
||||||
|
size_t len;
|
||||||
|
|
||||||
memset(ThisExtn, 0x00, sizeof(ThisExtn));
|
while (isspace(*WGL_Extensions)) WGL_Extensions++;
|
||||||
while (*WGL_Extensions != ' ' && *WGL_Extensions != 0x00) {
|
Start = WGL_Extensions;
|
||||||
|
while (!isspace(*WGL_Extensions) && *WGL_Extensions != 0x00) {
|
||||||
WGL_Extensions++;
|
WGL_Extensions++;
|
||||||
}
|
}
|
||||||
memcpy(ThisExtn, Start, (WGL_Extensions - Start));
|
|
||||||
|
len = WGL_Extensions - Start;
|
||||||
|
if (len == 0 || len >= sizeof(ThisExtn))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
memcpy(ThisExtn, Start, len);
|
||||||
|
ThisExtn[len] = '\0';
|
||||||
TRACE_(d3d_caps)("- %s\n", ThisExtn);
|
TRACE_(d3d_caps)("- %s\n", ThisExtn);
|
||||||
|
|
||||||
if (strstr(ThisExtn, "WGL_ARB_pbuffer")) {
|
if (!strcmp(ThisExtn, "WGL_ARB_pbuffer")) {
|
||||||
gl_info->supported[WGL_ARB_PBUFFER] = TRUE;
|
gl_info->supported[WGL_ARB_PBUFFER] = TRUE;
|
||||||
TRACE_(d3d_caps)("FOUND: WGL_ARB_pbuffer support\n");
|
TRACE_(d3d_caps)("FOUND: WGL_ARB_pbuffer support\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*WGL_Extensions == ' ') WGL_Extensions++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue