Mesa (master): anv: avoid null pointer dereference

Lionel Landwerlin llandwerlin at kemper.freedesktop.org
Mon May 8 13:40:14 UTC 2017


Module: Mesa
Branch: master
Commit: 6247b8b41321087a8931becc812819a76fcaebbb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6247b8b41321087a8931becc812819a76fcaebbb

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Tue May  2 22:06:01 2017 -0700

anv: avoid null pointer dereference

The application might not give an output structure.

CID: 1405765 (Null pointer dereferences)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>

---

 src/intel/vulkan/anv_formats.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index 4c930eda1d..c39cec3800 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -715,7 +715,8 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties2KHR(
    if (external_info && external_info->handleType != 0) {
       switch (external_info->handleType) {
       case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHX:
-         external_props->externalMemoryProperties = prime_fd_props;
+         if (external_props)
+            external_props->externalMemoryProperties = prime_fd_props;
          break;
       default:
          /* From the Vulkan 1.0.42 spec:




More information about the mesa-commit mailing list