Commit de3486dd authored by Francois Jacques's avatar Francois Jacques Committed by Alexandre Julliard

Updated SafeArrayGetUBound and SafeArrayGetLBound with more sanity

checks: an array has at least one dimension. Updated validCoordinates, where SafeArrayGetLBound was called on dimension 0.
parent e93588b7
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment