PipeWire capturer: fix crash when dlopening EGL and OpenGL

We need to use RTC_NOT_SANITIZE("cfi-icall") everywhere where we do
function typecasting, otherwise doing official Chrome builds will result
into crash.

Bug: chromium:1262535
Change-Id: If7358ccab6bd626e494b7ecd3077aa29502080c1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/236587
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35281}
This commit is contained in:
Jan Grulich 2021-10-28 22:52:37 +02:00 committed by WebRTC LUCI CQ
parent 448231d654
commit 4d7657e27b

View File

@ -157,6 +157,7 @@ static void CloseLibrary(void* library) {
static void* g_lib_egl = nullptr;
RTC_NO_SANITIZE("cfi-icall")
static bool OpenEGL() {
g_lib_egl = dlopen("libEGL.so.1", RTLD_NOW | RTLD_GLOBAL);
if (g_lib_egl) {
@ -168,6 +169,7 @@ static bool OpenEGL() {
return false;
}
RTC_NO_SANITIZE("cfi-icall")
static bool LoadEGL() {
if (OpenEGL()) {
EglBindAPI = (eglBindAPI_func)EglGetProcAddress("eglBindAPI");
@ -198,6 +200,7 @@ static bool LoadEGL() {
static void* g_lib_gl = nullptr;
RTC_NO_SANITIZE("cfi-icall")
static bool OpenGL() {
std::vector<std::string> names = {"libGL.so.1", "libGL.so"};
for (const std::string& name : names) {
@ -212,6 +215,7 @@ static bool OpenGL() {
return false;
}
RTC_NO_SANITIZE("cfi-icall")
static bool LoadGL() {
if (OpenGL()) {
GlGetString = (glGetString_func)GlXGetProcAddressARB("glGetString");