VirtualBox

Ignore:
Timestamp:
Jul 16, 2014 1:53:24 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
95047
Message:

RTMemSafer: Split generic from ring-3 specific page based implementation. Adjusted the ring-3 implementation to use RTMemPage when SUPR3PageAllocEx isn't available, and to separate the real data from the heap metadata to make finding the data just a little bit more difficult.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/math/bignum.cpp

    r52018 r52050  
    118118    Assert(cbNew > cbOld);
    119119
    120     void *pvNew = NULL;
     120    void *pvNew;
    121121    if (pBigNum->fSensitive)
    122     {
    123         int rc = RTMemSaferReallocZEx(cbOld, pBigNum->pauElements, cbNew, &pvNew, RTMEMSAFER_ALLOC_EX_ALLOW_PAGEABLE_BACKING);
    124         Assert(VALID_PTR(pvNew) || RT_FAILURE(rc));
    125     }
     122        pvNew = RTMemSaferReallocZ(cbOld, pBigNum->pauElements, cbNew);
    126123    else
    127124        pvNew = RTMemRealloc(pBigNum->pauElements, cbNew);
     
    326323        pBigNum->cAllocated = RT_ALIGN_32(pBigNum->cUsed, 4);
    327324        if (pBigNum->fSensitive)
    328         {
    329             int rc = RTMemSaferAllocZEx((void **)&pBigNum->pauElements, pBigNum->cAllocated * RTBIGNUM_ELEMENT_SIZE,
    330                                         RTMEMSAFER_ALLOC_EX_ALLOW_PAGEABLE_BACKING);
    331             Assert(VALID_PTR(pBigNum->pauElements) || RT_FAILURE(rc));
    332         }
     325            pBigNum->pauElements = (RTBIGNUMELEMENT *)RTMemSaferAllocZ(pBigNum->cAllocated * RTBIGNUM_ELEMENT_SIZE);
    333326        else
    334327            pBigNum->pauElements = (RTBIGNUMELEMENT *)RTMemAlloc(pBigNum->cAllocated * RTBIGNUM_ELEMENT_SIZE);
     
    464457        pBigNum->cAllocated = RT_ALIGN_32(pBigNum->cUsed, 4);
    465458        if (pBigNum->fSensitive)
    466         {
    467             rc = RTMemSaferAllocZEx((void **)&pBigNum->pauElements, pBigNum->cAllocated * RTBIGNUM_ELEMENT_SIZE,
    468                                     RTMEMSAFER_ALLOC_EX_ALLOW_PAGEABLE_BACKING);
    469             Assert(VALID_PTR(pBigNum->pauElements) || RT_FAILURE(rc));
    470         }
     459            pBigNum->pauElements = (RTBIGNUMELEMENT *)RTMemSaferAllocZ(pBigNum->cAllocated * RTBIGNUM_ELEMENT_SIZE);
    471460        else
    472461            pBigNum->pauElements = (RTBIGNUMELEMENT *)RTMemAlloc(pBigNum->cAllocated * RTBIGNUM_ELEMENT_SIZE);
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