mirror of https://github.com/intel/gmmlib.git
Fix possible integer overflow
This commit is contained in:
parent
f056c5d326
commit
1f69d427fb
|
@ -237,7 +237,7 @@ GMM_STATUS GmmLib::GmmTextureCalc::GetTexStdLayoutOffset(GMM_TEXTURE_INFO * pT
|
|||
pReqInfo->StdLayout.TileDepthPitch = DepthPitch;
|
||||
}
|
||||
|
||||
PrevMipSize = DepthPitch * MipDepthTiles;
|
||||
PrevMipSize = (GMM_GFX_SIZE_T)DepthPitch * MipDepthTiles;
|
||||
SlicePitch += DepthPitch;
|
||||
}
|
||||
|
||||
|
@ -352,12 +352,12 @@ GMM_STATUS GmmLib::GmmTextureCalc::GetTexLockOffset(GMM_TEXTURE_INFO * pTexInf
|
|||
pReqInfo->Lock.Mip0SlicePitch = GFX_ULONG_CAST(pTexInfo->OffsetInfo.Texture3DOffsetInfo.Mip0SlicePitch);
|
||||
|
||||
// Actual address is offset based on requested slice
|
||||
AddressOffset += SliceRow * MipHeight * Pitch;
|
||||
AddressOffset += (GMM_GFX_SIZE_T)SliceRow * MipHeight * Pitch;
|
||||
|
||||
// Get to particular slice
|
||||
if(Slice % NumberOfMipsInSingleRow)
|
||||
{
|
||||
AddressOffset += (((Slice % NumberOfMipsInSingleRow) *
|
||||
AddressOffset += (((GMM_GFX_SIZE_T)(Slice % NumberOfMipsInSingleRow) *
|
||||
MipWidth * pTexInfo->BitsPerPixel) >>
|
||||
3);
|
||||
}
|
||||
|
@ -788,9 +788,9 @@ GMM_GFX_SIZE_T GmmLib::GmmTextureCalc::Get3DMipByteAddress(GMM_TEXTURE_INFO *
|
|||
MipHeight /= 2;
|
||||
}
|
||||
|
||||
ExtraBytes = PlaneRows * MipHeight * Pitch;
|
||||
ExtraBytes = (GMM_GFX_SIZE_T)PlaneRows * MipHeight * Pitch;
|
||||
|
||||
ExtraBytes += ((Slice % MipsInThisRow) *
|
||||
ExtraBytes += ((GMM_GFX_SIZE_T)(Slice % MipsInThisRow) *
|
||||
MipWidth * pTexInfo->BitsPerPixel) >>
|
||||
3;
|
||||
|
||||
|
|
|
@ -1024,12 +1024,12 @@ GMM_STATUS GmmLib::GmmXe_LPGTextureCalc::GetTexLockOffset(GMM_TEXTURE_INFO * p
|
|||
pReqInfo->Lock.Mip0SlicePitch = GFX_ULONG_CAST(pTexInfo->OffsetInfo.Texture3DOffsetInfo.Mip0SlicePitch);
|
||||
|
||||
// Actual address is offset based on requested slice
|
||||
AddressOffset += SliceRow * MipHeight * Pitch;
|
||||
AddressOffset += (GMM_GFX_SIZE_T)SliceRow * MipHeight * Pitch;
|
||||
|
||||
// Get to particular slice
|
||||
if(Slice % NumberOfMipsInSingleRow)
|
||||
{
|
||||
AddressOffset += (((Slice % NumberOfMipsInSingleRow) *
|
||||
AddressOffset += (((GMM_GFX_SIZE_T)(Slice % NumberOfMipsInSingleRow) *
|
||||
MipWidth * pTexInfo->BitsPerPixel) >>
|
||||
3);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue