On 4/27/21 10:48 AM, Dmitry Timoshkov wrote:
This fixes heap corruption when running the domdoc tests.
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> --- dlls/msxml3/domdoc.c | 12 +++++++++++- dlls/msxml3/tests/domdoc.c | 3 --- 2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index cf4f0433218..cb34632c203 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -2524,8 +2524,18 @@ static int XMLCALL domdoc_stream_save_writecallback(void *ctx, const char *buffe
static int XMLCALL domdoc_stream_save_closecallback(void *ctx) { + ULONG written; + HRESULT hr; + + hr = IStream_Write((IStream*)ctx, "\0", 1, &written); + if (hr != S_OK) + { + WARN("stream write error: 0x%08x\n", hr); + hr = -1; + } + IStream_Release((IStream*)ctx); - return 0; + return hr; } This will need a test on its own, if it really does that. Callback should return 0 or -1, as documented.