ole32: Add a check for a condition where a stream has an invalid size

and so there aren't enough blocks in the chain to write data into.
This commit is contained in:
Robert Shearman 2006-09-11 11:15:01 +01:00 committed by Alexandre Julliard
parent 106156cb75
commit aa336618ec
1 changed files with 8 additions and 0 deletions

View File

@ -4656,6 +4656,14 @@ HRESULT BlockChainStream_WriteAt(BlockChainStream* This,
This->lastBlockNoInSequenceIndex = blockIndex;
/* BlockChainStream_SetSize should have already been called to ensure we have
* enough blocks in the chain to write into */
if (blockIndex == BLOCK_END_OF_CHAIN)
{
ERR("not enough blocks in chain to write data\n");
return STG_E_DOCFILECORRUPT;
}
/*
* Here, I'm casting away the constness on the buffer variable
* This is OK since we don't intend to modify that buffer.