VirtualBox

Changeset 94864 in vbox


Ignore:
Timestamp:
May 5, 2022 6:29:18 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
151264
Message:

Main/Snapshot: Fix deparenting crash (lost in the big change for bugref:7717) and add some checks avoiding processing objects which have been already uninitialized and avoiding crashes due to dereferencing NULL pointers. bugref:10219

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/SnapshotImpl.cpp

    r94598 r94864  
    199199        Assert(pSnapshot->m->pMachine->isWriteLockOnCurrentThread());
    200200
     201        /* Remove initial snapshot from parent snapshot's list of children. */
     202        if (pSnapshot == this)
     203            pSnapshot->i_deparent();
     204
    201205        /* Paranoia. Shouldn't be set any more at processing time. */
    202         pSnapshot->m->pParent.setNull();
     206        Assert(!pSnapshot->m || pSnapshot->m->pParent.isNull());
    203207
    204208        /* Process all children */
     
    208212        {
    209213            Snapshot *pChild = *it;
     214
     215            if (!pChild || !pChild->m)
     216                continue;
     217
    210218            pChild->m->pParent.setNull();
    211219            llSnapshotsTodo.push_back(pChild);
     
    316324{
    317325    Assert(m->pMachine->isWriteLockOnCurrentThread());
     326
     327    if (m->pParent.isNull())
     328        return;
     329
     330    Assert(m->pParent->m);
    318331
    319332    SnapshotsList &llParent = m->pParent->m->llChildren;
     
    554567        llSnapshotsTodo.pop_front();
    555568
     569        /* Check if snapshot is uninitialized already, can happen if an API
     570         * client asks at an inconvenient time. */
     571        if (!pSnapshot->m)
     572            continue;
     573
    556574        cChildren += (ULONG)pSnapshot->m->llChildren.size();
    557575
     
    891909        for (SnapshotsList::const_iterator it = itBegin; it != itEnd; ++it)
    892910        {
     911            AutoCaller autoCaller(*it);
     912            if (FAILED(autoCaller.rc()))
     913                continue;
     914
    893915            llSnapshotsTodo.push_back(*it);
    894916            current->llChildSnapshots.push_back(settings::Snapshot::Empty);
Note: See TracChangeset for help on using the changeset viewer.

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