Hi Chao,

It is better and easier to add and use tests to demonstrate the bug. The winedbg log doesn't guarantee
ReleaseStgMedium() should check for NULL pointers.�� Also the email subject can be changed to
"[PATCH] ole32: Check invalid parameters for ReleaseStgMedium()." . And mention what application needs
this if you don't mind.

Thanks,
Zhiyi

On 9/21/20 1:50 PM, Chao Long wrote:
Wine-dbg>disas ReleaseStgMedium
0x7e240b48 ReleaseStgMedium [Z:\home\deepin\maintain5.0-stable\deepin-wine\dlls\ole32\ole2.c:2065] in ole32: lea ecx, [esp+0x4]��
0x7e240b4c ReleaseStgMedium+0x4 [Z:\home\deepin\maintain5.0-stable\deepin-wine\dlls\ole32\ole2.c:2065] in ole32: and esp, 0xfffffff0��
0x7e240b4f ReleaseStgMedium+0x7 [Z:\home\deepin\maintain5.0-stable\deepin-wine\dlls\ole32\ole2.c:2065] in ole32: push dword [ecx-0x4]��
0x7e240b52 ReleaseStgMedium+0xa [Z:\home\deepin\maintain5.0-stable\deepin-wine\dlls\ole32\ole2.c:2065] in ole32: push ebp��
0x7e240b53 ReleaseStgMedium+0xb [Z:\home\deepin\maintain5.0-stable\deepin-wine\dlls\ole32\ole2.c:2065] in ole32: mov ebp, esp��
0x7e240b55 ReleaseStgMedium+0xd [Z:\home\deepin\maintain5.0-stable\deepin-wine\dlls\ole32\ole2.c:2065] in ole32: push ebx��
0x7e240b56 ReleaseStgMedium+0xe [Z:\home\deepin\maintain5.0-stable\deepin-wine\dlls\ole32\ole2.c:2065] in ole32: push ecx��
0x7e240b57 ReleaseStgMedium+0xf [Z:\home\deepin\maintain5.0-stable\deepin-wine\dlls\ole32\ole2.c:2065] in ole32: sub esp, 0x10��
0x7e240b5a ReleaseStgMedium+0x12 [Z:\home\deepin\maintain5.0-stable\deepin-wine\dlls\ole32\ole2.c:2065] in ole32: mov ebx, ecx

Wine-dbg>info regs
Register dump:
��CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
��EIP:7e240b48 ESP:00300b68 EBP:00300b74 EFLAGS:00000202( �� - -- ��I �� - - - )
��EAX:1b690930 EBX:098b6178 ECX:13cd8044 EDX:1b686001
��ESI:13cd8040 EDI:090fcdd4

Wine-dbg>x 0x00300b6c
��0x00000000

Wine-dbg>info break
Breakpoints:
1: y 0x7e240b48 ReleaseStgMedium [Z:\home\deepin\maintain5.0-stable\deepin-wine\dlls\ole32\ole2.c:2065] in ole32 (1)
No watchpoints


0001-ole32-Fix-STGMEDIUM-is-NULL-Invalid-reference.patch
From 8f96278e5f603d4c465d4d197bc03f1d6143fdbe Mon Sep 17 00:00:00 2001
From: Chao Long <longchao@uniontech.com>
Date: Mon, 21 Sep 2020 13:02:03 +0800
Subject: [PATCH] ole32: Fix STGMEDIUM* is NULL Invalid reference.

Signed-off-by: Chao Long <longchao@uniontech.com>
---
 dlls/ole32/ole2.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c
index 15c4f8234f..4464ba0714 100644
--- a/dlls/ole32/ole2.c
+++ b/dlls/ole32/ole2.c
@@ -2023,6 +2023,8 @@ found:
 void WINAPI ReleaseStgMedium(
   STGMEDIUM* pmedium)
 {
+  if (!pmedium) return;
+
   switch (pmedium->tymed)
   {
     case TYMED_HGLOBAL: