loader: Don't scribble on caller memory in CreateInstance,CreateDevice
authorChris Forbes <chrisforbes@google.com>
Wed, 6 Apr 2016 08:49:02 +0000 (20:49 +1200)
committerJon Ashburn <jon@lunarg.com>
Thu, 7 Apr 2016 16:43:35 +0000 (10:43 -0600)
commitdd2e70c0799b302bc07b86f759afe9c0aaeda941
treec5374ce6acdc9983018e83be4931a3a0f6e6f419
parentad7bf024163e0d75a32717d71e7046a27ff38ea5
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>
loader/loader.c
loader/loader.h
loader/trampoline.c