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+

Emanuele Aina
Reported 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).
Attachments
Patch (5.72 KB, patch)
2016-10-20 01:58 PDT, Carlos Garcia Campos
zan: review+
Carlos Garcia Campos
Comment 1 2016-10-20 01:58:43 PDT
Carlos Garcia Campos
Comment 2 2016-10-20 05:39:00 PDT
Note You need to log in before you can comment on or make changes to this bug.