8 Apr
2025
8 Apr
'25
7:35 a.m.
Anton Baskanov (@baskanov) commented about dlls/amstream/ddrawstream.c:
DWORD flags) { struct ddraw_stream *stream = impl_from_IMemAllocator(iface); + HRESULT hr;
- return IMemAllocator_GetBuffer(stream->private_allocator, buf, start_time, end_time, flags); + EnterCriticalSection(&stream->cs); + + hr = IMemAllocator_GetBuffer(stream->private_allocator, buf, start_time, end_time, flags); + IMediaSample_SetMediaType(*buf, &stream->mt);
If `IMemAllocator_GetBuffer()` fails (e.g. when the allocator is decommitted) `*buf` will contain garbage. You should check `hr` before accessing it. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7715#note_100223