@@ -4426,9 +4426,14 @@ bool loader_get_layer_interface_version(PFN_vkNegotiateLoaderLayerInterfaceVersi
44264426void setup_logical_device_enabled_layer_extensions (const struct loader_instance * inst , struct loader_device * dev ,
44274427 const struct loader_extension_list * icd_exts ,
44284428 const VkDeviceCreateInfo * pCreateInfo ) {
4429+ // no enabled extensions, early exit
4430+ if (pCreateInfo -> ppEnabledExtensionNames == NULL ) {
4431+ return ;
4432+ }
44294433 // Can only setup debug marker as debug utils is an instance extensions.
44304434 for (uint32_t i = 0 ; i < pCreateInfo -> enabledExtensionCount ; ++ i ) {
4431- if (!strcmp (pCreateInfo -> ppEnabledExtensionNames [i ], VK_EXT_DEBUG_MARKER_EXTENSION_NAME )) {
4435+ if (pCreateInfo -> ppEnabledExtensionNames [i ] &&
4436+ !strcmp (pCreateInfo -> ppEnabledExtensionNames [i ], VK_EXT_DEBUG_MARKER_EXTENSION_NAME )) {
44324437 // Check if its supported by the driver
44334438 for (uint32_t j = 0 ; j < icd_exts -> count ; ++ j ) {
44344439 if (!strcmp (icd_exts -> list [j ].extensionName , VK_EXT_DEBUG_MARKER_EXTENSION_NAME )) {
@@ -5349,7 +5354,14 @@ VkResult loader_validate_instance_extensions(struct loader_instance *inst, const
53495354VkResult loader_validate_device_extensions (struct loader_instance * this_instance ,
53505355 const struct loader_pointer_layer_list * activated_device_layers ,
53515356 const struct loader_extension_list * icd_exts , const VkDeviceCreateInfo * pCreateInfo ) {
5357+ // Early out to prevent nullptr dereference
5358+ if (pCreateInfo -> enabledExtensionCount == 0 || pCreateInfo -> ppEnabledExtensionNames == NULL ) {
5359+ return VK_SUCCESS ;
5360+ }
53525361 for (uint32_t i = 0 ; i < pCreateInfo -> enabledExtensionCount ; i ++ ) {
5362+ if (pCreateInfo -> ppEnabledExtensionNames [i ] == NULL ) {
5363+ continue ;
5364+ }
53535365 VkStringErrorFlags result = vk_string_validate (MaxLoaderStringLength , pCreateInfo -> ppEnabledExtensionNames [i ]);
53545366 if (result != VK_STRING_ERROR_NONE ) {
53555367 loader_log (this_instance , VULKAN_LOADER_ERROR_BIT , 0 ,
@@ -5861,7 +5873,13 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice physical
58615873 }
58625874
58635875 for (uint32_t i = 0 ; i < pCreateInfo -> enabledExtensionCount ; i ++ ) {
5876+ if (pCreateInfo -> ppEnabledExtensionNames == NULL ) {
5877+ continue ;
5878+ }
58645879 const char * extension_name = pCreateInfo -> ppEnabledExtensionNames [i ];
5880+ if (extension_name == NULL ) {
5881+ continue ;
5882+ }
58655883 VkExtensionProperties * prop = get_extension_property (extension_name , & icd_exts );
58665884 if (prop ) {
58675885 filtered_extension_names [localCreateInfo .enabledExtensionCount ] = (char * )extension_name ;
0 commit comments