https://bugs.winehq.org/show_bug.cgi?id=41738
Bug ID: 41738 Summary: Cloning and releasing an IStream frees the HGLOBAL memory Product: Wine Version: 1.9.23 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: ole32 Assignee: wine-bugs@winehq.org Reporter: pgkos.bugzilla@yahoo.com Distribution: ArchLinux
I have been experiencing crashes (using Wine 1.9.23, 32-bit, on 32-bit Arch Linux with Linux kernel 4.8.8) in some of my apps. I have pinpointed the cause.
The issue can be reproduced this way:
1. Create a stream using CreateStreamOnHGlobal(). 2. Make a clone of it using IStream::Clone() (HGLOBALStreamImpl_Clone). 3. Release the original stream. 4. Unfortunately, the global memory (HGLOBAL) is freed when just one stream is released. 5. Trying to read the cloned stream via HGLOBALStreamImpl_Read fails, because the memory has been already freed.