diff options
author | Jason Macnak <natsu@google.com> | 2021-02-24 14:33:31 -0800 |
---|---|---|
committer | Jason Macnak <natsu@google.com> | 2021-03-02 15:57:49 +0000 |
commit | 11fada7928166f7cf6f6ffb4543f606994ab30fa (patch) | |
tree | 4c8c47e876594a5c5c9b8c9adbec818413fcb307 | |
parent | 6a09516b003e75a8b66c7f10133031557cb7d3a0 (diff) | |
download | native-11fada7928166f7cf6f6ffb4543f606994ab30fa.tar.gz |
Load ANGLEResetDisplayPlatform via dlsym
... which is slightly more defensive than loading the function via
eglGetProcAddress. When loading the function via eglGetProcAdress,
the returned function pointer will be one of the ext forwardering
helpers (__glExtFwd0 in this observed case). The process can then
crash if eglTerminate() is called on a new thread that has not yet
called eglMakeCurrent() where the thread local gl_hooks_t is 0x0.
Bug: b/181162754
Test: HeifWriterTest on Cuttlefish w/ SwANGLE
Change-Id: Ieebea08184e63321abbeccf41d1fdaf10e62ca2b
Merged-In: Ia8e55c899f9fde91215ce75313b33517f8440fee
-rw-r--r-- | opengl/libs/EGL/egl_angle_platform.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/opengl/libs/EGL/egl_angle_platform.cpp b/opengl/libs/EGL/egl_angle_platform.cpp index f82c2a4ee7..6c07ad4cf0 100644 --- a/opengl/libs/EGL/egl_angle_platform.cpp +++ b/opengl/libs/EGL/egl_angle_platform.cpp @@ -130,8 +130,7 @@ bool initializeAnglePlatform(EGLDisplay dpy) { } angleResetDisplayPlatform = - reinterpret_cast<ResetDisplayPlatformFunc>( - eglGetProcAddress("ANGLEResetDisplayPlatform")); + reinterpret_cast<ResetDisplayPlatformFunc>(dlsym(so, "ANGLEResetDisplayPlatform")); PlatformMethods* platformMethods = nullptr; if (!((angleGetDisplayPlatform)(dpy, g_PlatformMethodNames, |