Bug 161958 - [GTK] Avoid strstr() when checking (E)GL extensions
Summary: [GTK] Avoid strstr() when checking (E)GL extensions
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 163333
  Show dependency treegraph
 
Reported: 2016-09-14 05:27 PDT by Emanuele Aina
Modified: 2016-10-20 05:39 PDT (History)
2 users (show)

See Also:


Attachments
Patch (5.72 KB, patch)
2016-10-20 01:58 PDT, Carlos Garcia Campos
zan: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Emanuele Aina 2016-09-14 05:27:55 PDT
Using strstr() is not sufficient to safely check for (E)GL extensions, because it may match a substring of the extension name you're testing for. For example, if you're testing for the GL_EXT_texture extension and glGetString(GL_EXTENSIONS) returns "GL_EXT_texture3D" then simply using strstr() will incorrectly tell you that GL_EXT_texture is supported. (From http://www.mesa3d.org/brianp/sig97/exten.htm )

We currently use strstr() with no extra checks in GLContextEGL::createSurfacelessContext() (for EGL_KHR_surfaceless_context and EGL_KHR_surfaceless_opengl) and in WaylandCompositor::initializeEGL() (for EGL_KHR_image_base).

GLPlatformContext::supportsEGLExtension() does it correctly, but it seems to belong to a separate tree of GL context types (GLPlatformContext, GLXOffscreenContext and EGLOffscreenContext) which is are not used by the GTK+ port (which uses GLContext, GLContextGLX and GLContextEGL, usually by way of GraphicsContext3D).
Comment 1 Carlos Garcia Campos 2016-10-20 01:58:43 PDT
Created attachment 292159 [details]
Patch
Comment 2 Carlos Garcia Campos 2016-10-20 05:39:00 PDT
Committed r207614: <http://trac.webkit.org/changeset/207614>