VirtualBox

Changeset 39123 in vbox


Ignore:
Timestamp:
Oct 26, 2011 8:24:47 PM (13 years ago)
Author:
vboxsync
Message:

Main/Machine: fix use after free bug caused by non-obvious std::list behavior

File:
1 edited

Legend:

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

    r38999 r39123  
    67586758    /* attach launch data to the machine */
    67596759    Assert(mData->mSession.mPid == NIL_RTPROCESS);
    6760     mData->mSession.mRemoteControls.push_back (aControl);
     6760    mData->mSession.mRemoteControls.push_back(aControl);
    67616761    mData->mSession.mProgress = aProgress;
    67626762    mData->mSession.mPid = pid;
     
    98129812    setModified(IsModified_Storage);
    98139813    mMediaData.backup();
    9814 
    9815     // we cannot use erase (it) below because backup() above will create
    9816     // a copy of the list and make this copy active, but the iterator
    9817     // still refers to the original and is not valid for the copy
    98189814    mMediaData->mAttachments.remove(pAttach);
    98199815
     
    1161211608        ComAssertMsgRet(found, ("The session is not found in the session list!"),
    1161311609                         E_INVALIDARG);
    11614         mData->mSession.mRemoteControls.remove(*it);
     11610        // This MUST be erase(it), not remove(*it) as the latter triggers a
     11611        // very nasty use after free due to the place where the value "lives".
     11612        mData->mSession.mRemoteControls.erase(it);
    1161511613    }
    1161611614
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