Bug 161958

Summary: [GTK] Avoid strstr() when checking (E)GL extensions
Product: WebKit Reporter: Emanuele Aina <emanuele.aina>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, cgarcia
Priority: P2    
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 163333    
Attachments:
Description Flags
Patch zan: review+

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>