Module: wine Branch: master Commit: 38aa7696c57f9d3484a97ce9fb209c2ce1e9c32a URL: http://source.winehq.org/git/wine.git/?a=commit;h=38aa7696c57f9d3484a97ce9fb...
Author: Aric Stewart aric@codeweavers.com Date: Tue Nov 8 09:31:57 2011 -0600
usp10: Avoid an end of buffer overrun when seeking non space characters at an end of a BiDi string.
---
dlls/usp10/usp10.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c index 05468eb..2a6107e 100644 --- a/dlls/usp10/usp10.c +++ b/dlls/usp10/usp10.c @@ -856,7 +856,10 @@ HRESULT WINAPI ScriptItemizeOpenType(const WCHAR *pwcInChars, int cInChars, int int j = 1; while (cnt + j < cInChars - 1 && (pwcInChars[cnt+j] == Numeric_space || pwcInChars[cnt+j] == ZWJ || pwcInChars[cnt+j] == ZWNJ)) j++; - New_Script = get_char_script(pwcInChars[cnt+j]); + if (cnt + j < cInChars) + New_Script = get_char_script(pwcInChars[cnt+j]); + else + New_Script = get_char_script(pwcInChars[cnt]); }
if ((levels && (levels[cnt] != pItems[index].a.s.uBidiLevel || (strength && (strength[cnt] != str)))) || (New_Script != -1 && New_Script != pItems[index].a.eScript) || New_Script == Script_Control)