Commit 76702f33 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

usp10: Fixed some oom handling (Coverity).

parent 118dc199
......@@ -1029,6 +1029,8 @@ static BOOL requires_fallback(HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa,
return TRUE;
glyphs = heap_alloc(sizeof(WORD) * cChars);
if (!glyphs)
return FALSE;
if (ScriptGetCMap(hdc, psc, pwcInChars, cChars, 0, glyphs) != S_OK)
{
heap_free(glyphs);
......@@ -1111,6 +1113,11 @@ HRESULT WINAPI ScriptStringAnalyse(HDC hdc, const void *pString, int cString,
if (dwFlags & SSA_PASSWORD)
{
iString = heap_alloc(sizeof(WCHAR)*cString);
if (!iString)
{
hr = E_OUTOFMEMORY;
goto error;
}
for (i = 0; i < cString; i++)
iString[i] = *((const WCHAR *)pString);
pString = iString;
......@@ -1133,6 +1140,9 @@ HRESULT WINAPI ScriptStringAnalyse(HDC hdc, const void *pString, int cString,
}
if (hr != S_OK) goto error;
/* set back to out of memory for default goto error behaviour */
hr = E_OUTOFMEMORY;
if (dwFlags & SSA_BREAK)
{
if ((analysis->logattrs = heap_alloc(sizeof(SCRIPT_LOGATTR) * cString)))
......@@ -1173,6 +1183,18 @@ HRESULT WINAPI ScriptStringAnalyse(HDC hdc, const void *pString, int cString,
const WCHAR* pStr = (const WCHAR*)pString;
analysis->glyphs[i].fallbackFont = NULL;
if (!glyphs || !pwLogClust || !piAdvance || !psva || !pGoffset || !abc)
{
heap_free (glyphs);
heap_free (pwLogClust);
heap_free (piAdvance);
heap_free (psva);
heap_free (pGoffset);
heap_free (abc);
hr = E_OUTOFMEMORY;
goto error;
}
if ((dwFlags & SSA_FALLBACK) && requires_fallback(hdc, sc, &analysis->pItem[i].a, &pStr[analysis->pItem[i].iCharPos], cChar))
{
LOGFONTW lf;
......
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