Module: wine Branch: master Commit: 0ddd236480fa1cf9e3ef1c3b01bdc0f1d335f2b5 URL: http://source.winehq.org/git/wine.git/?a=commit;h=0ddd236480fa1cf9e3ef1c3b01...
Author: Stefan Dösinger stefan@codeweavers.com Date: Tue Feb 13 20:24:39 2007 +0100
wined3d: Check error conditions before creating the object.
---
dlls/wined3d/device.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 5804df8..2315a45 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -505,13 +505,18 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac WINED3DFORMAT Format = WINED3DFMT_VERTEXDATA; /* Dummy format for now */ int dxVersion = ( (IWineD3DImpl *) This->wineD3D)->dxVersion; BOOL conv; + + if(Size == 0) { + WARN("Size 0 requested, returning WINED3DERR_INVALIDCALL\n"); + *ppVertexBuffer = NULL; + return WINED3DERR_INVALIDCALL; + } + D3DCREATERESOURCEOBJECTINSTANCE(object, VertexBuffer, WINED3DRTYPE_VERTEXBUFFER, Size)
TRACE("(%p) : Size=%d, Usage=%d, FVF=%x, Pool=%d - Memory@%p, Iface@%p\n", This, Size, Usage, FVF, Pool, object->resource.allocatedMemory, object); *ppVertexBuffer = (IWineD3DVertexBuffer *)object;
- if(Size == 0) return WINED3DERR_INVALIDCALL; - if (Pool == WINED3DPOOL_DEFAULT ) { /* Allocate some system memory for now */ object->resource.allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, object->resource.size); }