ole32/stg_bigblockfile: Check page before use (Coverity).

This commit is contained in:
Paul Vriens 2007-04-03 20:41:42 +02:00 committed by Alexandre Julliard
parent de0871795c
commit ec30f6de30
1 changed files with 8 additions and 8 deletions

View File

@ -861,14 +861,7 @@ static HRESULT WINAPI ImplBIGBLOCKFILE_WriteAt(
MappedPage *page = BIGBLOCKFILE_GetMappedView(This, page_index);
TRACE("page %i, offset %u, bytes_to_page %u, bytes_left %u\n",
page->page_index, offset_in_page, bytes_to_page, bytes_left);
if (page->mapped_bytes < bytes_to_page)
{
ERR("Not enough bytes mapped to the page. This should never happen\n");
rc = E_FAIL;
break;
}
page ? page->page_index : 0, offset_in_page, bytes_to_page, bytes_left);
if (!page)
{
@ -877,6 +870,13 @@ static HRESULT WINAPI ImplBIGBLOCKFILE_WriteAt(
break;
}
if (page->mapped_bytes < bytes_to_page)
{
ERR("Not enough bytes mapped to the page. This should never happen\n");
rc = E_FAIL;
break;
}
writePtr = (BYTE*)page->lpBytes + offset_in_page;
memcpy(writePtr,readPtr,bytes_to_page);
BIGBLOCKFILE_ReleaseMappedPage(This, page);