vulkaninfo: handle NULL layer_name.
authorDave Airlie <airlied@redhat.com>
Fri, 12 Apr 2019 06:53:19 +0000 (16:53 +1000)
committerjeremyk-lunarg <jeremyk@lunarg.com>
Tue, 23 Apr 2019 19:19:30 +0000 (13:19 -0600)
Earlier we check for a NULL layer name but not here.

Vulkan-Tools-sdk-1.1.101.0/vulkaninfo/vulkaninfo.c:4403: var_deref_model: Passing null pointer "layer_name" to "strcmp", which dereferences it.

Pointed out by coverity.

vulkaninfo/vulkaninfo.c

index 0fec633..8dfa33b 100644 (file)
@@ -4716,7 +4716,7 @@ static void AppDumpExtensions(const char *indent, const char *layer_name, const
         printf("\tcount = %d\n", extension_count);
     }
 
-    const bool is_device_type = strcmp(layer_name, "Device") == 0;
+    const bool is_device_type = layer_name && (strcmp(layer_name, "Device") == 0);
     if (is_device_type && json_output) {
         printf(",\n");
         printf("\t\"ArrayOfVkExtensionProperties\": [");