Module: wine
Branch: master
Commit: aa336618ecb0a2d76a6e49877c515691c694e4e9
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=aa336618ecb0a2d76a6e498…
Author: Robert Shearman <rob(a)codeweavers.com>
Date: Mon Sep 11 11:15:01 2006 +0100
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.
---
dlls/ole32/storage32.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 19f09fc..187ba0b 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -4656,6 +4656,14 @@ HRESULT BlockChainStream_WriteAt(BlockCh
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.