ole32: Don't read past the end of the stream when converting block types.

This commit is contained in:
Andrew Eikum 2009-08-21 14:33:40 -05:00 committed by Alexandre Julliard
parent bfe83b22c2
commit a0aaa65507
1 changed files with 5 additions and 4 deletions

View File

@ -3563,7 +3563,7 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
{
resRead = SmallBlockChainStream_ReadAt(*ppsbChain,
offset,
This->smallBlockSize,
min(This->smallBlockSize, size.u.LowPart - offset.u.LowPart),
buffer,
&cbRead);
if (FAILED(resRead))
@ -3582,7 +3582,7 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
if (FAILED(resWrite))
break;
offset.u.LowPart += This->smallBlockSize;
offset.u.LowPart += cbRead;
}
} while (cbTotalRead.QuadPart < size.QuadPart);
HeapFree(GetProcessHeap(),0,buffer);
@ -3663,7 +3663,8 @@ SmallBlockChainStream* Storage32Impl_BigBlocksToSmallBlocks(
do
{
resRead = BlockChainStream_ReadAt(*ppbbChain, offset,
This->bigBlockSize, buffer, &cbRead);
min(This->bigBlockSize, size.u.LowPart - offset.u.LowPart),
buffer, &cbRead);
if(FAILED(resRead))
break;
@ -3678,7 +3679,7 @@ SmallBlockChainStream* Storage32Impl_BigBlocksToSmallBlocks(
if(FAILED(resWrite))
break;
offset.u.LowPart += This->bigBlockSize;
offset.u.LowPart += cbRead;
}
}while(cbTotalRead.QuadPart < size.QuadPart);
HeapFree(GetProcessHeap(), 0, buffer);