diff options
| author | Chris Forbes <chrisforbes@google.com> | 2016-04-06 20:49:02 +1200 |
|---|---|---|
| committer | Jon Ashburn <jon@lunarg.com> | 2016-04-07 10:43:35 -0600 |
| commit | dd2e70c0799b302bc07b86f759afe9c0aaeda941 (patch) | |
| tree | c5374ce6acdc9983018e83be4931a3a0f6e6f419 /loader/loader.h | |
| parent | ad7bf024163e0d75a32717d71e7046a27ff38ea5 (diff) | |
| download | usermoji-dd2e70c0799b302bc07b86f759afe9c0aaeda941.tar.xz | |
loader: Don't scribble on caller memory in CreateInstance,CreateDevice
expand_... / unexpand_... scribbled on both the CreateInfo struct and
the list of layer strings, and then unscribbled them on the way back
out. This is a lousy thing to do, and just blows up if the memory isn't
writable (which it needn't be, given the API takes ptrs to const).
Instead, copy the *CreateInfo into a shadow struct on the stack, and be
careful in expand_layer_names never to scribble on the caller's layer
names array.
V2: slight tweak (missed initializer)
Signed-off-by: Chris Forbes <chrisforbes@google.com>
Diffstat (limited to 'loader/loader.h')
| -rw-r--r-- | loader/loader.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/loader/loader.h b/loader/loader.h index 84f4d6fe..6c192a21 100644 --- a/loader/loader.h +++ b/loader/loader.h @@ -478,15 +478,13 @@ void loader_expand_layer_names( const struct loader_instance *inst, const char *key_name, uint32_t expand_count, const char expand_names[][VK_MAX_EXTENSION_NAME_SIZE], - uint32_t *layer_count, char ***ppp_layer_names); -void loader_unexpand_dev_layer_names(const struct loader_instance *inst, - uint32_t layer_count, char **layer_names, - char **layer_ptr, - const VkDeviceCreateInfo *pCreateInfo); -void loader_unexpand_inst_layer_names(const struct loader_instance *inst, - uint32_t layer_count, char **layer_names, - char **layer_ptr, - const VkInstanceCreateInfo *pCreateInfo); + uint32_t *layer_count, char const * const **ppp_layer_names); +void loader_delete_shadow_dev_layer_names(const struct loader_instance *inst, + const VkDeviceCreateInfo *orig, + VkDeviceCreateInfo *ours); +void loader_delete_shadow_inst_layer_names(const struct loader_instance *inst, + const VkInstanceCreateInfo *orig, + VkInstanceCreateInfo *ours); void loader_add_to_layer_list(const struct loader_instance *inst, struct loader_layer_list *list, uint32_t prop_list_count, |
