Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72cd929d authored by Tim Van Patten's avatar Tim Van Patten
Browse files

eglGetProcAddressImpl(): Validate procname is non-null

The EGL spec states:

> procName must be a NULL-terminated string

Add validation that procname is non-null before dereferencing it to
prevent crashing due to a bad user input. This is not required by the
EGL spec, but we are explicitly choosing to fail gracefully (return
nullptr) rather than performing undefined behavior (crashing).

Bug: b/279980674
Flag: EXEMPT bugfix
Test: angle_end2end_tests \
  --gtest_filter=EGLReadinessCheckTest.GetProcAddressNullInput/*
Change-Id: Ibcfacdacd3a7ffbb3c255ce3d975764d1f048970
parent c4aacbb9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1196,6 +1196,12 @@ static __eglMustCastToProperFunctionPointerType findBuiltinWrapper(const char* p
}

__eglMustCastToProperFunctionPointerType eglGetProcAddressImpl(const char* procname) {
    // This is not required by the EGL spec, but we're choosing to fail gracefully (return nullptr)
    // rather than performing undefined behavior (crashing).
    if (procname == nullptr) {
        return nullptr;
    }

    if (FILTER_EXTENSIONS(procname)) {
        return nullptr;
    }