VirtualBox

Changeset 102899 in vbox for trunk/src


Ignore:
Timestamp:
Jan 16, 2024 2:24:57 PM (13 months ago)
Author:
vboxsync
Message:

Runtime/common/fatvfs.cpp: Need to reset the S/G buffer when flushing the cluster map before writing the data, regression from r158845

The cluster map flushing code is directly modifying stuff in the S/G buffer structure instead of using the API but does it incorrectly.
This results in the members for the current segment pointer and remaining bytes remaining in the current segment to be NULL or 0 respectively.
The lower layer called through RTVfsFileSgWrite() will get a NULL pointer and 0 size for the current buffer when trying to access the S/G buffer
(stdfile in this case) causing no data to be written.
This worked before r158845 because the lower code would not actually use the S/G buffer but traverse the segment array directly not caring about
RTSGBUF::pvSegCur and RTSGBUF::cbSegLeft but was changed to use the RTSgBuf* API which will return NULL if both RTSGBUF::pvSegCur and RTSGBUF::cbSegLeft
are NULL or 0 respectively.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/fs/fatvfs.cpp

    r100908 r102899  
    972972                                     || SgBuf.cSegs >= RT_ELEMENTS(aSgSegs))
    973973                            {
     974                                RTSgBufReset(&SgBuf);
    974975                                int rc2 = RTVfsFileSgWrite(pThis->hVfsBacking, off, &SgBuf, true /*fBlocking*/, NULL);
    975976                                if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
    976977                                    rc = rc2;
    977                                 RTSgBufReset(&SgBuf);
    978978                                SgBuf.cSegs = 0;
    979979                                off = offDirtyLine;
     
    10041004    if (SgBuf.cSegs > 0)
    10051005    {
     1006        RTSgBufReset(&SgBuf);
    10061007        int rc2 = RTVfsFileSgWrite(pThis->hVfsBacking, off, &SgBuf, true /*fBlocking*/, NULL);
    10071008        if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
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