In the definition of the SAFEARRAY data structure cDims is listed as USHORT
typedef struct tagSAFEARRAY {
USHORT cDims;
USHORT fFeatures;
ULONG cbElements;
ULONG cLocks;
PVOID pvData;
SAFEARRAYBOUND rgsabound[1];
} SAFEARRAY, *LPSAFEARRAY;
Both SafeArrayCreate and SafeArrayAllocDescriptor expect a UINT
SAFEARRAY* SafeArrayCreate(
_In_ VARTYPE vt,
_In_ UINT cDims,
_In_ SAFEARRAYBOUND *rgsabound
);
What will happen if I pass a really large UINT to SafeArrayCreate? Is it a bug, what am I missing here?