Piotr Caban : msxml3: Add error handling when reading from IStream.

Alexandre Julliard julliard at winehq.org
Thu Aug 21 10:02:35 CDT 2008


Module: wine
Branch: master
Commit: 126c0abeefb05af8137abdcc7c9271848bfaf5fa
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=126c0abeefb05af8137abdcc7c9271848bfaf5fa

Author: Piotr Caban <piotr.caban at gmail.com>
Date:   Wed Aug 20 18:32:02 2008 +0200

msxml3: Add error handling when reading from IStream.

---

 dlls/msxml3/saxreader.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/dlls/msxml3/saxreader.c b/dlls/msxml3/saxreader.c
index 7affb4a..2e35eaa 100644
--- a/dlls/msxml3/saxreader.c
+++ b/dlls/msxml3/saxreader.c
@@ -1876,8 +1876,20 @@ static HRESULT WINAPI internal_parse(
                     if(hr == E_PENDING) continue;
                     break;
                 }
+                if(hr != S_OK)
+                {
+                    IStream_Release(stream);
+                    break;
+                }
+
                 data = HeapAlloc(GetProcessHeap(), 0,
                         dataInfo.cbSize.QuadPart);
+                if(!data)
+                {
+                    IStream_Release(stream);
+                    break;
+                }
+
                 while(1)
                 {
                     hr = IStream_Read(stream, data,
@@ -1885,6 +1897,13 @@ static HRESULT WINAPI internal_parse(
                     if(hr == E_PENDING) continue;
                     break;
                 }
+                if(hr != S_OK)
+                {
+                    HeapFree(GetProcessHeap(), 0, data);
+                    IStream_Release(stream);
+                    break;
+                }
+
                 hr = internal_parseBuffer(This, data,
                         dataInfo.cbSize.QuadPart, vbInterface);
                 HeapFree(GetProcessHeap(), 0, data);




More information about the wine-cvs mailing list