Commit e7d7ac77 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

wined3d: Add more padding to resource memory allocations.

parent 4e95553a
...@@ -332,7 +332,11 @@ void CDECL wined3d_resource_preload(struct wined3d_resource *resource) ...@@ -332,7 +332,11 @@ void CDECL wined3d_resource_preload(struct wined3d_resource *resource)
static BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) static BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource)
{ {
void **p; void **p;
SIZE_T align = RESOURCE_ALIGNMENT - 1 + sizeof(*p); /* Overallocate and add padding to the allocated pointer, to guard against
* games (for instance Railroad Tycoon 2) writing before the locked resource
* memory pointer.
*/
SIZE_T align = RESOURCE_ALIGNMENT + sizeof(*p);
void *mem; void *mem;
if (!(mem = heap_alloc_zero(resource->size + align))) if (!(mem = heap_alloc_zero(resource->size + align)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment