diff options
author | Patrick Rudolph <siro@das-labor.org> | 2015-11-14 13:02:43 +0100 |
---|---|---|
committer | Axel Davy <axel.davy@ens.fr> | 2016-02-04 22:12:17 +0100 |
commit | 827fee059e702b22c6f5e4a61fb1aff3e926899d (patch) | |
tree | 90c475663998b088d915108969fa25697d4f1774 | |
parent | 5c79bd666b1163de42d6b4c0fc1a7fa2fd3c6b8e (diff) |
st/nine: Fix resource9 private data
Store a copy of GUID in the header that is under our control and use it
as key for the hashtable instead of using the application provided pointer.
The application might change the memory after leaving the function.
Fixes a crash for issue https://github.com/iXit/Mesa-3D/issues/130
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
-rw-r--r-- | src/gallium/state_trackers/nine/nine_pdata.h | 1 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/resource9.c | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/nine/nine_pdata.h b/src/gallium/state_trackers/nine/nine_pdata.h index 7bdd702cfb..0e9a2aa716 100644 --- a/src/gallium/state_trackers/nine/nine_pdata.h +++ b/src/gallium/state_trackers/nine/nine_pdata.h @@ -5,6 +5,7 @@ struct pheader { boolean unknown; + GUID guid; DWORD size; char data[1]; }; diff --git a/src/gallium/state_trackers/nine/resource9.c b/src/gallium/state_trackers/nine/resource9.c index f3c26896aa..56e85156a2 100644 --- a/src/gallium/state_trackers/nine/resource9.c +++ b/src/gallium/state_trackers/nine/resource9.c @@ -141,8 +141,9 @@ NineResource9_SetPrivateData( struct NineResource9 *This, header->size = SizeOfData; memcpy(header->data, user_data, header->size); + memcpy(&header->guid, refguid, sizeof(header->guid)); - err = util_hash_table_set(This->pdata, refguid, header); + err = util_hash_table_set(This->pdata, &header->guid, header); if (err == PIPE_OK) { if (header->unknown) { IUnknown_AddRef(*(IUnknown **)header->data); } return D3D_OK; |