Fixes: 2127e9ae7d90466f3b8883708799047214409832
---
Fixes a crash on macOS. Perhaps the extensions string regularly has a trailing space on other platforms? The previous filter_extensions_list method set `end` differently and avoided this case.
-- v4: opengl32: Avoid null pointer dereferences when filtering extensions.
From: Tim Clem tclem@codeweavers.com
Fixes: 2127e9ae7d90466f3b8883708799047214409832 --- dlls/opengl32/unix_wgl.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index b7892c2851d..3e153db9cc7 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -729,7 +729,7 @@ static BOOL is_extension_supported( struct context *ctx, const char *extension ) static GLubyte *filter_extensions( struct context *ctx, const char *extensions ) { const char *end, **extra; - size_t size, len; + size_t size; char *p, *str;
size = strlen( extensions ) + 2; @@ -742,13 +742,15 @@ static GLubyte *filter_extensions( struct context *ctx, const char *extensions ) { while (*extensions == ' ') extensions++; if (!*extensions) break; - len = (end = strchr( extensions, ' ' )) ? end - extensions : strlen( extensions ); - memcpy( p, extensions, len ); - p[len] = 0; + + if (!(end = strchr( extensions, ' ' ))) end = extensions + strlen( extensions ); + memcpy( p, extensions, end - extensions ); + p[end - extensions] = 0; + if (is_extension_supported( ctx, p )) { TRACE( "++ %s\n", p ); - p += len; + p += end - extensions; *p++ = ' '; } else
On Wed Nov 5 18:56:17 2025 +0000, Tim Clem wrote:
Switched back to that in v3
Ugh, and with the removal of len in v4. Sorry, testing on macOS without -Werror
This merge request was approved by Rémi Bernon.
This merge request was approved by Jacek Caban.