ole32/stg_bigblockfile: Check page before use (Coverity).
This commit is contained in:
parent
de0871795c
commit
ec30f6de30
|
@ -861,14 +861,7 @@ static HRESULT WINAPI ImplBIGBLOCKFILE_WriteAt(
|
||||||
MappedPage *page = BIGBLOCKFILE_GetMappedView(This, page_index);
|
MappedPage *page = BIGBLOCKFILE_GetMappedView(This, page_index);
|
||||||
|
|
||||||
TRACE("page %i, offset %u, bytes_to_page %u, bytes_left %u\n",
|
TRACE("page %i, offset %u, bytes_to_page %u, bytes_left %u\n",
|
||||||
page->page_index, offset_in_page, bytes_to_page, bytes_left);
|
page ? page->page_index : 0, 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!page)
|
if (!page)
|
||||||
{
|
{
|
||||||
|
@ -877,6 +870,13 @@ static HRESULT WINAPI ImplBIGBLOCKFILE_WriteAt(
|
||||||
break;
|
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;
|
writePtr = (BYTE*)page->lpBytes + offset_in_page;
|
||||||
memcpy(writePtr,readPtr,bytes_to_page);
|
memcpy(writePtr,readPtr,bytes_to_page);
|
||||||
BIGBLOCKFILE_ReleaseMappedPage(This, page);
|
BIGBLOCKFILE_ReleaseMappedPage(This, page);
|
||||||
|
|
Loading…
Reference in New Issue