VirtualBox

Changeset 75049 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Oct 24, 2018 4:06:42 PM (6 years ago)
Author:
vboxsync
Message:

IPRT,SUPDrv: Added cbImage parameter to FNRTLDRRDRMEMDTOR; sketched the basics for darwin module verification. bugref:9232

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/ldr/ldrMemory.cpp

    r73150 r75049  
    8080 *      Default destructor - pvUser points to the image memory block}
    8181 */
    82 static DECLCALLBACK(void) rtldrRdrMemDefaultDtor(void *pvUser)
    83 {
     82static DECLCALLBACK(void) rtldrRdrMemDefaultDtor(void *pvUser, size_t cbImage)
     83{
     84    RT_NOREF(cbImage);
    8485    RTMemFree(pvUser);
    8586}
     
    202203{
    203204    PRTLDRRDRMEM pThis = (PRTLDRRDRMEM)pReader;
    204     pThis->pfnDtor(pThis->pvUser);
     205    pThis->pfnDtor(pThis->pvUser, pThis->cbImage);
     206    pThis->pfnDtor = NULL;
     207    pThis->pvUser = NULL;
    205208    RTMemFree(pThis);
    206209    return VINF_SUCCESS;
     
    279282    /* The rest of the validations will call the destructor. */
    280283    AssertMsgReturnStmt(!(fFlags & ~RTLDR_O_VALID_MASK), ("%#x\n", fFlags),
    281                         pfnDtor(pvUser), VERR_INVALID_PARAMETER);
     284                        pfnDtor(pvUser, cbImage), VERR_INVALID_PARAMETER);
    282285    AssertMsgReturnStmt(enmArch > RTLDRARCH_INVALID && enmArch < RTLDRARCH_END, ("%d\n", enmArch),
    283                         pfnDtor(pvUser), VERR_INVALID_PARAMETER);
     286                        pfnDtor(pvUser, cbImage), VERR_INVALID_PARAMETER);
    284287    if (!pfnRead)
    285288        pfnRead = rtldrRdrMemDefaultReader;
    286289    else
    287         AssertReturnStmt(RT_VALID_PTR(pfnRead), pfnDtor(pvUser), VERR_INVALID_POINTER);
    288     AssertReturnStmt(cbImage > 0, pfnDtor(pvUser), VERR_INVALID_PARAMETER);
     290        AssertReturnStmt(RT_VALID_PTR(pfnRead), pfnDtor(pvUser, cbImage), VERR_INVALID_POINTER);
     291    AssertReturnStmt(cbImage > 0, pfnDtor(pvUser, cbImage), VERR_INVALID_PARAMETER);
    289292
    290293    /*
     
    312315    else
    313316    {
    314         pfnDtor(pvUser);
     317        pfnDtor(pvUser, cbImage);
    315318        rc = RTErrInfoSetF(pErrInfo, rc, "rtldrRdrMem_Create failed: %Rrc", rc);
    316319    }
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