VirtualBox

Ignore:
Timestamp:
Nov 20, 2018 5:08:26 PM (6 years ago)
Author:
vboxsync
Message:

IPRT/fatvfs.cpp: Fixed bug in rtFsFatChain_GetClusterByIndex that caused issues accessing large files and replacing them.

File:
1 edited

Legend:

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

    r73097 r75627  
    731731             */
    732732            pPart = RTListGetFirst(&pChain->ListParts, RTFSFATCHAINPART, ListEntry);
    733             while (idxPart-- > 1)
     733            while (idxPart-- > 0)
    734734                pPart = RTListGetNext(&pChain->ListParts, pPart, RTFSFATCHAINPART, ListEntry);
    735735        }
     
    905905{
    906906    PRTFSFATCLUSTERMAPCACHE pFatCache = pThis->pFatCache;
     907    Log3(("rtFsFatClusterMap_FlushWorker: %p %#x %#x\n", pThis, iFirstEntry, iLastEntry));
    907908
    908909    /*
     
    12261227
    12271228        /* Next cluster. */
     1229#ifdef LOG_ENABLED
     1230        const uint32_t idxPrevCluster = idxCluster;
     1231#endif
    12281232        bool     fOdd   = idxCluster & 1;
    12291233        uint32_t offFat = idxCluster * 3 / 2;
     
    12331237        else
    12341238            idxCluster &= 0x0fff;
     1239        Log4(("Fat/ReadChain12: [%#x] %#x (next: %#x)\n", pChain->cClusters - 1, idxPrevCluster, idxCluster));
    12351240    }
    12361241}
     
    13831388    if (idxCluster & 1)
    13841389    {
     1390        Log3(("Fat/SetCluster12: [%#x]: %#x -> %#x\n", idxCluster, (((pbFat[offFat]) & 0xf0) >> 4) | ((unsigned)pbFat[offFat + 1] << 4), uValue));
    13851391        pbFat[offFat]     = ((uint8_t)0x0f & pbFat[offFat]) | ((uint8_t)uValue << 4);
    13861392        pbFat[offFat + 1] = (uint8_t)(uValue >> 4);
     
    13881394    else
    13891395    {
     1396        Log3(("Fat/SetCluster12: [%#x]: %#x -> %#x\n", idxCluster, pbFat[offFat] | ((pbFat[offFat + 1] & 0x0f) << 8), uValue));
    13901397        pbFat[offFat]     = (uint8_t)uValue;
    13911398        pbFat[offFat + 1] = ((uint8_t)0xf0 & pbFat[offFat + 1]) | (uint8_t)(uValue >> 8);
     
    22992306        }
    23002307    }
     2308    Log3(("rtFsFatObj_SetSize: Returns %Rrc\n", rc));
    23012309    return rc;
    23022310}
     
    26432651                if (   (fOpen & RTFILE_O_TRUNCATE)
    26442652                    || (fOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_CREATE_REPLACE)
     2653                {
     2654                    Log3(("rtFsFatFile_New: calling rtFsFatObj_SetSize to zap the file size.\n"));
    26452655                    rc = rtFsFatObj_SetSize(&pShared->Core, 0);
     2656                }
    26462657                if (RT_SUCCESS(rc))
    26472658                {
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