Robert Shearman : ole: Check the return value of IStream_SetSize in IStream_Read.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 3 06:37:34 CST 2006


Module: wine
Branch: refs/heads/master
Commit: dfa74b998ee8729f9129cd72119bf1e36f74fc23
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=dfa74b998ee8729f9129cd72119bf1e36f74fc23

Author: Robert Shearman <rob at codeweavers.com>
Date:   Tue Jan  3 12:07:49 2006 +0100

ole: Check the return value of IStream_SetSize in IStream_Read.
Check the return value of IStream_SetSize in IStream_Read, since
otherwise execution could continue on and cause heap corruption.

---

 dlls/ole32/hglobalstream.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/dlls/ole32/hglobalstream.c b/dlls/ole32/hglobalstream.c
index ca73a22..4d1d4b5 100644
--- a/dlls/ole32/hglobalstream.c
+++ b/dlls/ole32/hglobalstream.c
@@ -313,7 +313,12 @@ static HRESULT WINAPI HGLOBALStreamImpl_
   if (newSize.u.LowPart > This->streamSize.u.LowPart)
   {
     /* grow stream */
-   IStream_SetSize(iface, newSize);
+    HRESULT hr = IStream_SetSize(iface, newSize);
+    if (FAILED(hr))
+    {
+      ERR("IStream_SetSize failed with error 0x%08lx\n", hr);
+      return hr;
+    }
   }
 
   /*




More information about the wine-cvs mailing list