VirtualBox

Changeset 39679 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Dec 27, 2011 9:14:19 PM (13 years ago)
Author:
vboxsync
Message:

AsyncCompletion: Check that reads are always in the file limits and return an error before starting I/O

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp

    r39078 r39679  
    10971097                 pTask, pEndpoint, off, paSegments, cSegments, cbRead));
    10981098
     1099    if (RT_UNLIKELY(off + cbRead > pEpFile->cbFile))
     1100        return VERR_EOF;
     1101
    10991102    STAM_PROFILE_ADV_START(&pEpFile->StatRead, Read);
    11001103    pdmacFileEpTaskInit(pTask, cbRead);
     
    11631166static int pdmacFileEpSetSize(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, uint64_t cbSize)
    11641167{
     1168    int rc;
    11651169    PPDMASYNCCOMPLETIONENDPOINTFILE pEpFile = (PPDMASYNCCOMPLETIONENDPOINTFILE)pEndpoint;
    11661170
    1167     ASMAtomicWriteU64(&pEpFile->cbFile, cbSize);
    1168     return RTFileSetSize(pEpFile->hFile, cbSize);
     1171    rc = RTFileSetSize(pEpFile->hFile, cbSize);
     1172    if (RT_SUCCESS(rc))
     1173        ASMAtomicWriteU64(&pEpFile->cbFile, cbSize);
     1174
     1175    return rc;
    11691176}
    11701177
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette