Remove indexing on layer_prop_list
authorCharles Giessen <charles@lunarg.com>
Fri, 23 Jun 2023 03:36:39 +0000 (21:36 -0600)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Fri, 23 Jun 2023 04:27:45 +0000 (22:27 -0600)
The usage of the layer property list inside of
loader_check_layer_list_for_phys_dev_ext_address was modified when the
list changed from an array of struct loader_layer_properties, to an array
of pointers to struct loader_layer_properties. Except, the usages of
layer_prop_list were not updated in kind, leading to out of bounds indexes
when searching for unknown physical device functions in layers. This causes
crashes in the validation layer tests, which make use of this functionality.

loader/unknown_function_handling.c

index 792a6bd45207342bae9c90de628b9665b852b913..650b40e4d9357b41dfa473860ad35a30c6fe83d3 100644 (file)
@@ -203,8 +203,8 @@ bool loader_check_layer_list_for_phys_dev_ext_address(struct loader_instance *in
         // Find the first layer in the call chain which supports vk_layerGetPhysicalDeviceProcAddr
         // and call that, returning whether it found a valid pointer for this function name.
         // We return if the topmost layer supports GPDPA since the layer should call down the chain for us.
-        if (layer_prop_list[layer].interface_version > 1) {
-            const struct loader_layer_functions *const functions = &(layer_prop_list[layer].functions);
+        if (layer_prop_list->interface_version > 1) {
+            const struct loader_layer_functions *const functions = &(layer_prop_list->functions);
             if (NULL != functions->get_physical_device_proc_addr) {
                 return NULL != functions->get_physical_device_proc_addr((VkInstance)inst->instance, funcName);
             }