VirtualBox

Changeset 83558 in vbox for trunk/src


Ignore:
Timestamp:
Apr 4, 2020 11:35:03 PM (5 years ago)
Author:
vboxsync
Message:

VMMDev: Adjusted RTMemFreeZ use - must use our private pGuestParm->u.ptr.cbData member not the pHostParm->u.pointer.size one as it can have been modified by the HGCM service. bugref:9698

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp

    r83551 r83558  
    351351                VBOXHGCMGUESTPARM * const pGuestParm = &pCmd->u.call.paGuestParms[i];
    352352
    353                 if (pHostParm->type == VBOX_HGCM_SVC_PARM_PTR)
    354                     RTMemFreeZ(pHostParm->u.pointer.addr, pHostParm->u.pointer.size);
    355 
    356353                if (   pGuestParm->enmType == VMMDevHGCMParmType_LinAddr_In
    357354                    || pGuestParm->enmType == VMMDevHGCMParmType_LinAddr_Out
     
    360357                    || pGuestParm->enmType == VMMDevHGCMParmType_ContiguousPageList)
    361358                {
     359                    Assert(pHostParm->type == VBOX_HGCM_SVC_PARM_PTR);
    362360                    if (pGuestParm->u.ptr.paPages != &pGuestParm->u.ptr.GCPhysSinglePage)
    363361                        RTMemFree(pGuestParm->u.ptr.paPages);
     362                    RTMemFreeZ(pHostParm->u.pointer.addr, pGuestParm->u.ptr.cbData);
     363                }
     364                else if (pGuestParm->enmType == VMMDevHGCMParmType_Embedded)
     365                {
     366                    Assert(pHostParm->type == VBOX_HGCM_SVC_PARM_PTR);
     367                    RTMemFreeZ(pHostParm->u.pointer.addr, pGuestParm->u.ptr.cbData);
    364368                }
    365369                else if (pGuestParm->enmType == VMMDevHGCMParmType_NoBouncePageList)
    366370                {
     371                    Assert(pHostParm->type == VBOX_HGCM_SVC_PARM_PAGES);
    367372                    if (pGuestParm->u.Pages.paPgLocks)
    368373                    {
     
    374379                    }
    375380                }
     381                else
     382                    Assert(pHostParm->type != VBOX_HGCM_SVC_PARM_PTR && pHostParm->type != VBOX_HGCM_SVC_PARM_PAGES);
    376383            }
    377384        }
     
    707714
    708715            case VMMDevHGCMParmType_PageList:
    709                 RT_FALL_THRU();
    710716            case VMMDevHGCMParmType_LinAddr_In:
    711717            case VMMDevHGCMParmType_LinAddr_Out:
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