Updated SafeArrayGetUBound and SafeArrayGetLBound with more sanity

checks: an array has at least one dimension.
Updated validCoordinates, where SafeArrayGetLBound was called on
dimension 0.
This commit is contained in:
Francois Jacques 2000-12-21 20:18:18 +00:00 committed by Alexandre Julliard
parent e93588b7a4
commit de3486dd1c
1 changed files with 8 additions and 2 deletions

View File

@ -373,6 +373,9 @@ HRESULT WINAPI SafeArrayGetUBound(
if(nDim > psa->cDims)
return DISP_E_BADINDEX;
if(0 == nDim)
return DISP_E_BADINDEX;
*plUbound = psa->rgsabound[nDim-1].lLbound +
psa->rgsabound[nDim-1].cElements - 1;
@ -394,6 +397,9 @@ HRESULT WINAPI SafeArrayGetLBound(
if(nDim > psa->cDims)
return DISP_E_BADINDEX;
if(0 == nDim)
return DISP_E_BADINDEX;
*plLbound = psa->rgsabound[nDim-1].lLbound;
return S_OK;
}
@ -951,9 +957,9 @@ static BOOL validCoordinate(
HRESULT hRes;
for(; iter<psa->cDims; iter++) {
if((hRes = SafeArrayGetLBound(psa, iter, &lLBound)) != S_OK)
if((hRes = SafeArrayGetLBound(psa, (iter+1), &lLBound)) != S_OK)
return FALSE;
if((hRes = SafeArrayGetUBound(psa, iter, &lUBound)) != S_OK)
if((hRes = SafeArrayGetUBound(psa, (iter+1), &lUBound)) != S_OK)
return FALSE;
if(lLBound == lUBound)