From: http://www.nabble.com/0001-Sanity-Check-in-ImmSetCompositionStringA-and-ImmSetC.patch-td18769013.html [0001-Sanity-Check-in-ImmSetCompositionStringA-and-ImmSetC.patch] From 6d5387362b9773d5f0e938cf22eae0530973ae43 Mon Sep 17 00:00:00 2001 From: Jason Borden <jborden@...> Date: Thu, 31 Jul 2008 23:40:24 -0600 Subject: [PATCH] Sanity Check in ImmSetCompositionStringA and ImmSetCompositionStringW This patch adds an additional sanity check to the dwIndex variable of the ImmSetCompositionStringA and ImmSetCompostionStringW functions. API documentation specifies that dwIndex can have one of the following values: SCS_SETSTR SCS_CHANGEATTR SCS_CHANGECLAUSE SCS_SETRECONVERTSTRING SCS_QUERYRECONVERTSTRING Pre patch, if an application executes this function with an invalid dwIndex value, a recursive loop results (As is the case in Final Fantasy XI). --- dlls/imm32/imm.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 94b7752..ab08dec 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -2011,6 +2011,14 @@ BOOL WINAPI ImmSetCompositionStringA( TRACE("(%p, %d, %p, %d, %p, %d):\n", hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen); + if (dwIndex != SCS_SETSTR && dwIndex != SCS_CHANGEATTR && dwIndex != + SCS_CHANGECLAUSE && dwIndex != SCS_SETRECONVERTSTRING && dwIndex != + SCS_QUERYRECONVERTSTRING) + { + TRACE("Invalid dwIndex parameter specified\n"); + return FALSE; + } + if (!data) return FALSE; @@ -2059,6 +2067,14 @@ BOOL WINAPI ImmSetCompositionStringW( TRACE("(%p, %d, %p, %d, %p, %d):\n", hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen); + if (dwIndex != SCS_SETSTR && dwIndex != SCS_CHANGEATTR && dwIndex != + SCS_CHANGECLAUSE && dwIndex != SCS_SETRECONVERTSTRING && dwIndex != + SCS_QUERYRECONVERTSTRING) + { + TRACE("Invalid dwIndex parameter specified\n"); + return FALSE; + } + if (!data) return FALSE; -- 1.5.3.4 Reproducible: Always Steps to Reproduce: 1. Play Final Fantasy XI in Wine Actual Results: Low framerates which require an in-game "hack" to correct Expected Results: Decent framerates without the in-game hack. See also: http://appdb.winehq.org/objectManager.php?sClass=version&iId=2739
Thanks for the reporting the patch, assigning to maintainers
we dont have manpower for wine ... patches get sent upstream and get applied there
It took me a whole 2 minutes to modify the ebuild to apply the patch right before it compiles. There is at least one other Wine patch that gets applied the same way. Can I submit an ebuild and patch file and it gets called "-r1" or something? This patch was submitted over a month ago to wine devs I believe and still has not made it into a release.