[PATCH] ole32: Add a check for hglobal pointer to GetHGlobalFromStream.

Huw Davies huw at codeweavers.com
Mon Aug 17 09:27:21 CDT 2020


On Wed, Aug 12, 2020 at 08:19:55AM +0800, Dmitry Timoshkov wrote:
> Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
> ---
>  dlls/ole32/hglobalstream.c       | 4 ++--
>  dlls/ole32/tests/hglobalstream.c | 6 ++++++
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/dlls/ole32/hglobalstream.c b/dlls/ole32/hglobalstream.c
> index 4590bb9c43..4cfedd66a1 100644
> --- a/dlls/ole32/hglobalstream.c
> +++ b/dlls/ole32/hglobalstream.c
> @@ -664,10 +664,10 @@ HRESULT WINAPI GetHGlobalFromStream(IStream* pstm, HGLOBAL* phglobal)
>  {
>    HGLOBALStreamImpl* pStream;
>  
> -  if (pstm == NULL)
> +  if (!pstm || !phglobal)
>      return E_INVALIDARG;
>  
> -  pStream = (HGLOBALStreamImpl*) pstm;
> +  pStream = impl_from_IStream(pstm);

We don't usually go for these type of parameter checks
unless an application needs them, which is why I didn't
send it in when I looked at the rest of the series.

However, since there's already a check for pstm...

Signed-off-by: Huw Davies <huw at codeweavers.com>



More information about the wine-devel mailing list