From 382350e3488014a9a11e166b5d4872e0df095fd8 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Tue, 7 Sep 2010 19:17:43 -0500 Subject: [PATCH] ole32: Don't fail if the file ends during a big block. Apparently, it's valid for the last block in a file to be incomplete. --- dlls/ole32/storage32.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 8b6a3af..5c58201 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -3875,13 +3875,20 @@ static BOOL StorageImpl_ReadBigBlock( void* buffer) { ULARGE_INTEGER ulOffset; - DWORD read; + DWORD read=0; ulOffset.u.HighPart = 0; ulOffset.u.LowPart = StorageImpl_GetBigBlockOffset(This, blockIndex); StorageImpl_ReadAt(This, ulOffset, buffer, This->bigBlockSize, &read); - return (read == This->bigBlockSize); + + if (read && read < This->bigBlockSize) + { + /* File ends during this block; fill the rest with 0's. */ + memset((LPBYTE)buffer+read, 0, This->bigBlockSize-read); + } + + return (read != 0); } static BOOL StorageImpl_ReadDWordFromBigBlock( -- 1.6.3.3