https://bugs.winehq.org/show_bug.cgi?id=18477
--- Comment #23 from Rafał Mużyło galtgendo@o2.pl --- So, just dropping a note about an odd, though somewhat interesting result.
My crash was fixed, when in dlls/wined3d/resource.c, in 'BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource)' I've added 32 to HeapAlloc size argument. The surface getting corrupted was a 16bit 256x32 one, so 32 wouldn't cover even a single column, which given the data is written by rows... Still don't know why this particular value worked (16 didn't).
This was found after a hint from Stefan Dösinger to use WINEDEBUG=warn+heap, which prevented the crash, but was sending errors due to corruption still taking place.