VirtualBox

Changeset 91091 in vbox


Ignore:
Timestamp:
Sep 2, 2021 1:06:51 PM (3 years ago)
Author:
vboxsync
Message:

Runtime/vfs/vfsmemory.cpp: Fix a bug causing the extent lookup to fail if the file starts with zeroes and the offset for the lookup falls into that area, fix a second bug in the write code where the zeros in the source buffer are not skipped leading to data corruption

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/vfs/vfsmemory.cpp

    r82968 r91091  
    172172    if (!pExtent || off < pExtent->off)
    173173    {
     174        /* Check whether the offset is before the first extent first. */
     175        pExtent = RTListGetFirst(&pThis->ExtentHead, RTVFSMEMEXTENT, Entry);
     176        if (   pExtent
     177            && off < pExtent->off)
     178        {
     179            *pfHit = false;
     180            return pExtent;
     181        }
     182
    174183        /* Consider the last entry first (for writes). */
    175184        pExtent = RTListGetLast(&pThis->ExtentHead, RTVFSMEMEXTENT, Entry);
     
    484493                if (!cbLeftToWrite)
    485494                    break;
     495                pbSrc += cbZeros;
    486496
    487497                Assert(!pExtent || offUnsigned <= pExtent->off);
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