We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3698

Summary: EGL and GL extension parsing has issues
Product: SDL Reporter: Simon Hug <chli.hug>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: All   
Attachments: Patch that fixes extension parsing issues and adds EGL client extension querying.

Description Simon Hug 2017-07-07 13:31:14 UTC
Created attachment 2789 [details]
Patch that fixes extension parsing issues and adds EGL client extension querying.

SDL_EGL_HasExtension is unable to detect the last extension in the string if it is directly followed by the terminating zero.

SDL_GL_ExtensionSupported has an out-of-bounds guard when checking for the space character but uses the wrong pointer in the comparison. This may cause it to incorrectly report an extension as present. Example: GL_EXT_moo is matched in the second half of GL_EXT_mooGL_EXT_moo.

The attached patch fixes these issues and also adds querying of client extension with EGL_EXT_client_extensions and EGL 1.5. This will probably be used for the KMSDRM driver proposed in bug 3690.
Comment 1 Simon Hug 2017-07-07 13:33:51 UTC
Oh, I forgot. In the patch, I commented out some error messages. Since the SDL_EGL_HasExtension function is an internal one, what would be the proper way to signal an error there? Asserts? Could you give me an example how that could look?
Comment 2 Simon Hug 2017-08-03 22:31:02 UTC
This is now resolved. Fix was in the kmsdrm video driver patch.