This fixes heap corruption when running the domdoc tests.
v3: Apparently Windows 8 and later started to \0 terminate buffer in ::save, so to avoid test failures perform comparisons with memcmp() instead of strcmp().
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/msxml3/tests/domdoc.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 6f8e2b44ed3..ba8453430c6 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -8586,8 +8586,7 @@ todo_wine hr = GetHGlobalFromStream(stream, &global); ok(hr == S_OK, "got 0x%08x\n", hr); p = GlobalLock(global); - p[GlobalSize(global)] = 0; - ok(!strcmp(p, xml2) || !strcmp(p, xml2_wine), "got %s\n", wine_dbgstr_a(p)); + ok(!memcmp(p, xml2, sizeof(xml2) - 1) || !memcmp(p, xml2_wine, sizeof(xml2_wine) - 1), "got %s\n", wine_dbgstr_a(p)); GlobalUnlock(global);
/* Verify the result after load+save */ @@ -8609,8 +8608,7 @@ todo_wine hr = GetHGlobalFromStream(stream, &global); ok(hr == S_OK, "got 0x%08x\n", hr); p = GlobalLock(global); - p[GlobalSize(global)] = 0; - ok(!strcmp(p, xml2) || !strcmp(p, xml2_wine), "got %s\n", wine_dbgstr_a(p)); + ok(!memcmp(p, xml2, sizeof(xml2) - 1) || !memcmp(p, xml2_wine, sizeof(xml2_wine) - 1), "got %s\n", wine_dbgstr_a(p)); GlobalUnlock(global);
IStream_Release(stream); @@ -8631,8 +8629,7 @@ todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
p = GlobalLock(global); - p[GlobalSize(global)] = 0; - ok(!strcmp(p, xml3) || !strcmp(p, xml3_wine), "got %s\n", wine_dbgstr_a(p)); + ok(!memcmp(p, xml3, sizeof(xml3) - 1) || !memcmp(p, xml3_wine, sizeof(xml3_wine) - 1), "got %s\n", wine_dbgstr_a(p)); GlobalUnlock(global);
IStream_Release(stream);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
On 4/27/21 12:29 PM, Dmitry Timoshkov wrote:
This fixes heap corruption when running the domdoc tests.
v3: Apparently Windows 8 and later started to \0 terminate buffer in ::save, so to avoid test failures perform comparisons with memcmp() instead of strcmp().
Change is fine, however comment is incorrect I think. On Windows 10, checking up to HGLOBAL size does not show any nulls.