Open ghost opened 10 years ago
Tagging @sschukat as the original SourceForge issue creator.
Proposed patch with updated formatting and location:
diff --git a/com/win32com/src/oleargs.cpp b/com/win32com/src/oleargs.cpp
index c6fad6c2..bffc6346 100644
--- a/com/win32com/src/oleargs.cpp
+++ b/com/win32com/src/oleargs.cpp
@@ -901,7 +901,14 @@ static PyObject *PyCom_PyObjectFromSAFEARRAYDimensionItem(SAFEARRAY *psa, VARENU
// case VT_DECIMAL
// case VT_RECORD
- case VT_I1:
+ case VT_I1: {
+ char i1;
+ hres = SafeArrayGetElement(psa, arrayIndices, &i1);
+ if (FAILED(hres))
+ break;
+ subitem = PyInt_FromLong(i1);
+ break;
+ }
case VT_UI1: {
unsigned char i1;
hres = SafeArrayGetElement(psa, arrayIndices, &i1);
In case a server transports VT_I1 SAFEARRAYs to the client a wrong interpretation to VT_UI1 is done in Python. Hence the client retrieves wrong data, i.e. -128 is transformed to +128. The attached patch fixes the problem.
Reported by: sschukat
Original Ticket: pywin32/bugs/652