mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 00:10:10 +01:00
egl: do not access member of a NULL structure
Check if the structure is NULL before trying to get access to its members. This has been detected by the Undefined Behaviour Sanitizer (UBSan). Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29772>
This commit is contained in:
parent
ee1ced9dc5
commit
017bd4bf25
1 changed files with 5 additions and 3 deletions
|
|
@ -983,8 +983,10 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
|
|||
!draw_surf->ProtectedContent)
|
||||
RETURN_EGL_ERROR(disp, EGL_BAD_ACCESS, EGL_FALSE);
|
||||
|
||||
egl_relax (disp, &draw_surf->Resource, &read_surf->Resource,
|
||||
&context->Resource) {
|
||||
egl_relax (disp,
|
||||
draw_surf ? &draw_surf->Resource : NULL,
|
||||
read_surf ? &read_surf->Resource : NULL,
|
||||
context ? &context->Resource : NULL) {
|
||||
ret = disp->Driver->MakeCurrent(disp, draw_surf, read_surf, context);
|
||||
}
|
||||
|
||||
|
|
@ -1837,7 +1839,7 @@ _eglCreateImageCommon(_EGLDisplay *disp, EGLContext ctx, EGLenum target,
|
|||
if (ctx != EGL_NO_CONTEXT && target == EGL_LINUX_DMA_BUF_EXT)
|
||||
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
|
||||
|
||||
egl_relax (disp, &context->Resource) {
|
||||
egl_relax (disp, context ? &context->Resource : NULL) {
|
||||
img =
|
||||
disp->Driver->CreateImageKHR(disp, context, target, buffer, attr_list);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue