Rob Shearman : oleaut32: Handle strings with a length of 0xffff in SLTG_DoVars.
Alexandre Julliard
julliard at winehq.org
Wed Jul 30 08:36:05 CDT 2008
Module: wine
Branch: master
Commit: 9f9d8dc6839a724ee3c894227b93cff8c53c3031
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9f9d8dc6839a724ee3c894227b93cff8c53c3031
Author: Rob Shearman <robertshearman at gmail.com>
Date: Wed Jul 30 13:18:47 2008 +0100
oleaut32: Handle strings with a length of 0xffff in SLTG_DoVars.
This means that the string is NULL so don't attempt to access the
string data in this case.
---
dlls/oleaut32/typelib.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index fd60db2..c569fb2 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -3161,9 +3161,15 @@ static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsign
case VT_BSTR:
{
WORD len = *(WORD *)(pBlk + pItem->byte_offs);
- INT alloc_len = MultiByteToWideChar(CP_ACP, 0, pBlk + pItem->byte_offs + 2, len, NULL, 0);
- BSTR str = SysAllocStringLen(NULL, alloc_len);
- MultiByteToWideChar(CP_ACP, 0, pBlk + pItem->byte_offs + 2, len, str, alloc_len);
+ BSTR str;
+ TRACE_(typelib)("len = %u\n", len);
+ if (len == 0xffff) {
+ str = NULL;
+ } else {
+ INT alloc_len = MultiByteToWideChar(CP_ACP, 0, pBlk + pItem->byte_offs + 2, len, NULL, 0);
+ str = SysAllocStringLen(NULL, alloc_len);
+ MultiByteToWideChar(CP_ACP, 0, pBlk + pItem->byte_offs + 2, len, str, alloc_len);
+ }
V_VT((*ppVarDesc)->vardesc.u.lpvarValue) = VT_BSTR;
V_BSTR((*ppVarDesc)->vardesc.u.lpvarValue) = str;
break;
More information about the wine-cvs
mailing list