usp10: Properly handle invalid arguments to ScriptBreak.

This commit is contained in:
Aric Stewart 2012-03-19 13:48:39 -05:00 committed by Alexandre Julliard
parent c110a55f12
commit 5bb7590fad
2 changed files with 15 additions and 1 deletions

View File

@ -2798,6 +2798,19 @@ static void test_ScriptBreak(void)
hr = ScriptItemize(test, 3, 4, NULL, NULL, items, NULL);
ok(!hr, "ScriptItemize should return S_OK not %08x\n", hr);
/*
* This Test crashes pre Vista.
hr = ScriptBreak(test, 1, &items[0].a, NULL);
ok(hr == E_INVALIDARG, "ScriptBreak should return E_INVALIDARG not %08x\n", hr);
*/
hr = ScriptBreak(test, 0, &items[0].a, &la);
ok(hr == E_FAIL || broken(hr == S_OK), "ScriptBreak should return E_FAIL not %08x\n", hr);
hr = ScriptBreak(test, -1, &items[0].a, &la);
ok(hr == E_INVALIDARG || broken(hr == S_OK), "ScriptBreak should return E_INVALIDARG not %08x\n", hr);
memset(&la, 0, sizeof(la));
hr = ScriptBreak(test, 1, &items[0].a, &la);
ok(!hr, "ScriptBreak should return S_OK not %08x\n", hr);

View File

@ -2665,7 +2665,8 @@ HRESULT WINAPI ScriptBreak(const WCHAR *chars, int count, const SCRIPT_ANALYSIS
{
TRACE("(%s, %d, %p, %p)\n", debugstr_wn(chars, count), count, sa, la);
if (!la) return S_FALSE;
if (count < 0 || !la) return E_INVALIDARG;
if (count == 0) return E_FAIL;
BREAK_line(chars, count, sa, la);