VirtualBox

Changeset 38881 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 27, 2011 9:28:32 AM (13 years ago)
Author:
vboxsync
Message:

PDMAsyncCompletion: Return an error for a read beyond the end of the file

File:
1 edited

Legend:

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

    r37597 r38881  
    12311231    STAM_PROFILE_ADV_START(&pEpFile->StatRead, Read);
    12321232
    1233     pdmacFileEpTaskInit(pTask, cbRead);
    1234 
    1235     rc = pdmacFileEpTaskInitiate(pTask, pEndpoint, off, paSegments, cSegments, cbRead,
    1236                                  PDMACTASKFILETRANSFER_READ);
     1233    if (RT_LIKELY(off + cbRead <= pEpFile->cbFile))
     1234    {
     1235        pdmacFileEpTaskInit(pTask, cbRead);
     1236
     1237        rc = pdmacFileEpTaskInitiate(pTask, pEndpoint, off, paSegments, cSegments, cbRead,
     1238                                     PDMACTASKFILETRANSFER_READ);
     1239    }
     1240    else
     1241        rc = VERR_EOF;
    12371242
    12381243    STAM_PROFILE_ADV_STOP(&pEpFile->StatRead, Read);
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