VirtualBox

Changeset 53011 in vbox


Ignore:
Timestamp:
Oct 9, 2014 2:12:54 PM (10 years ago)
Author:
vboxsync
Message:

SUP: instrumentation for debugging possible heap corruption.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyImage-win.cpp

    r53005 r53011  
    19441944#undef RESOLVE_CRYPT32_API
    19451945
     1946#ifndef IN_SUP_HARDENED_R3 /** @todo don't ship this in the final build! */
     1947    volatile uint8_t abDebugHint1[4096] = { 0 };
     1948    volatile uint8_t abDebugHint2[4096] = { 0 };
     1949#endif
     1950
    19461951    /*
    19471952     * Open the root store and look for the certificates we wish to use.
     
    19651970                                        RTErrInfoInitStatic(&StaticErrInfo),
    19661971                                        &g_RTAsn1DefaultAllocator, RTASN1CURSOR_FLAGS_DER, "CurCtx");
     1972#ifndef IN_SUP_HARDENED_R3 /** @todo don't ship this in the final build! */
     1973                memcpy((void *)&abDebugHint2[0], (void *)&abDebugHint2[0], sizeof(abDebugHint2));
     1974                memset((void *)&abDebugHint1[0], 0, sizeof(abDebugHint1));
     1975                memcpy((void *)&abDebugHint1[0], pCurCtx->pbCertEncoded, RT_MIN(pCurCtx->cbCertEncoded, sizeof(abDebugHint1)));
     1976                abDebugHint1[8] ^= 0x55; abDebugHint1[8] ^= 0x55; abDebugHint1[1999] ^= 0xcc; abDebugHint1[1999] ^= 0xcc;
     1977                abDebugHint2[8] ^= 0x55; abDebugHint2[8] ^= 0x55; abDebugHint2[1999] ^= 0xcc; abDebugHint2[1999] ^= 0xcc;
     1978                RTAsn1CursorInitPrimary(&PrimaryCursor, pCurCtx->pbCertEncoded, pCurCtx->cbCertEncoded,
     1979                                        RTErrInfoInitStatic(&StaticErrInfo),
     1980                                        &g_RTAsn1EFenceAllocator, RTASN1CURSOR_FLAGS_DER, "CurCtx");
     1981#endif
    19671982                RTCRX509CERTIFICATE MyCert;
    19681983                int rc = RTCrX509Certificate_DecodeAsn1(&PrimaryCursor.Cursor, 0, &MyCert, "Cert");
     
    19882003                else if (rc != VERR_ASN1_INVALID_UTC_TIME_ENCODING)
    19892004                    AssertMsgFailed(("RTCrX509Certificate_DecodeAsn1 failed: rc=%#x: %s\n", rc, StaticErrInfo.szMsg));
     2005#ifndef IN_SUP_HARDENED_R3 /** @todo don't ship this in the final build! */
     2006                abDebugHint1[999] ^= 0x63; abDebugHint1[999] ^= 0x63;
     2007                abDebugHint2[999] ^= 0x63; abDebugHint2[999] ^= 0x63;
     2008#endif
    19902009            }
    19912010        }
     
    19932012        g_fHaveOtherRoots = true;
    19942013    }
     2014#ifndef IN_SUP_HARDENED_R3 /** @todo don't ship this in the final build! */
     2015    abDebugHint1[2048] ^= 0x88; abDebugHint1[2048] ^= 0x88;
     2016    abDebugHint2[2048] ^= 0x88; abDebugHint2[2048] ^= 0x88;
     2017#endif
    19952018    SUP_DPRINTF(("supR3HardenedWinRetrieveTrustedRootCAs: cAdded=%u\n", cAdded));
    19962019}
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