https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e054a053ffcfada7afa1ff...
commit e054a053ffcfada7afa1ff438805e530146ebb70 Author: Baruch Rutman peterooch@gmail.com AuthorDate: Mon Jun 18 17:54:15 2018 +0300 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Fri Jul 27 00:47:28 2018 +0200
[LPK] Added more error handling code (#622).
- Added a codepath if both glyphs and reordered_str arrays are NULL. - Move variables back to the beginning of function.
CORE-14732 --- dll/win32/lpk/lpk.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/dll/win32/lpk/lpk.c b/dll/win32/lpk/lpk.c index 85e2e8faf4..03ed3268ef 100644 --- a/dll/win32/lpk/lpk.c +++ b/dll/win32/lpk/lpk.c @@ -63,6 +63,11 @@ LpkExtTextOut( const INT *lpDx, INT unknown) { + LPWORD glyphs = NULL; + LPWSTR reordered_str = NULL; + INT cGlyphs; + BOOL bResult; + UNREFERENCED_PARAMETER(unknown);
if (!(fuOptions & ETO_IGNORELANGUAGE)) @@ -78,10 +83,7 @@ LpkExtTextOut( /* Check if the string requires complex script processing and not a "glyph indices" array */ if (ScriptIsComplex(lpString, uCount, SIC_COMPLEX) == S_OK && !(fuOptions & ETO_GLYPH_INDEX)) { - LPWORD glyphs = NULL; - LPWSTR reordered_str = HeapAlloc(GetProcessHeap(), 0, uCount * sizeof(WCHAR)); - INT cGlyphs; - BOOL bResult; + reordered_str = HeapAlloc(GetProcessHeap(), 0, uCount * sizeof(WCHAR));
BIDI_Reorder(hdc, lpString, uCount, GCP_REORDER, (fuOptions & ETO_RTLREADING) ? WINE_GCPW_FORCE_RTL : WINE_GCPW_FORCE_LTR, @@ -90,13 +92,17 @@ LpkExtTextOut( if (glyphs) { fuOptions |= ETO_GLYPH_INDEX; + uCount = cGlyphs; + }
- if (uCount != cGlyphs) - uCount = cGlyphs; + if (glyphs || reordered_str) + { + bResult = ExtTextOutW(hdc, x, y, fuOptions, lprc, + glyphs ? (LPWSTR)glyphs : reordered_str, uCount, lpDx); }
- bResult = ExtTextOutW(hdc, x, y, fuOptions, lprc, - glyphs ? (LPWSTR)glyphs : reordered_str, uCount, lpDx); + else + bResult = ExtTextOutW(hdc, x, y, fuOptions, lprc, lpString, uCount, lpDx);
HeapFree(GetProcessHeap(), 0, glyphs); HeapFree(GetProcessHeap(), 0, reordered_str);