[PATCH 1/8] usp10: Pass the correct buffer size to lstrcpynA() in load_GSUB_feature().

Henri Verbeet hverbeet at codeweavers.com
Thu Aug 19 11:57:43 CDT 2010


This fixes a performance regression introduced by
2fb344c117115701ce3c2d7df778786f58886e7c. The size passed to lstrcpynA()
includes the string terminator, so passing 4 would only copy the first 3
characters of "feat". This results in the array growing, but never finding the
requested feature. As a side note, the code for growing the array ignores
allocation failues, and doesn't look very scalable. Though perhaps we don't
want an unsorted array anyway for the sizes where it would matter.
---
 dlls/usp10/shape.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c
index df84b1f..cc0a3c0 100644
--- a/dlls/usp10/shape.c
+++ b/dlls/usp10/shape.c
@@ -780,7 +780,7 @@ static LPCVOID load_GSUB_feature(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc
     else
         psc->features = HeapAlloc(GetProcessHeap(), 0, psc->feature_count * sizeof(LoadedFeature));
 
-    lstrcpynA(psc->features[psc->feature_count - 1].tag,feat,4);
+    lstrcpynA(psc->features[psc->feature_count - 1].tag, feat, 5);
     psc->features[psc->feature_count - 1].feature = feature;
     return feature;
 }
-- 
1.7.1




More information about the wine-patches mailing list