Commit 5bb7590f authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

usp10: Properly handle invalid arguments to ScriptBreak.

parent c110a55f
...@@ -2798,6 +2798,19 @@ static void test_ScriptBreak(void) ...@@ -2798,6 +2798,19 @@ static void test_ScriptBreak(void)
hr = ScriptItemize(test, 3, 4, NULL, NULL, items, NULL); hr = ScriptItemize(test, 3, 4, NULL, NULL, items, NULL);
ok(!hr, "ScriptItemize should return S_OK not %08x\n", hr); 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)); memset(&la, 0, sizeof(la));
hr = ScriptBreak(test, 1, &items[0].a, &la); hr = ScriptBreak(test, 1, &items[0].a, &la);
ok(!hr, "ScriptBreak should return S_OK not %08x\n", hr); ok(!hr, "ScriptBreak should return S_OK not %08x\n", hr);
......
...@@ -2665,7 +2665,8 @@ HRESULT WINAPI ScriptBreak(const WCHAR *chars, int count, const SCRIPT_ANALYSIS ...@@ -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); 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); BREAK_line(chars, count, sa, la);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment