VirtualBox

Changeset 4198 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Aug 17, 2007 12:45:19 AM (17 years ago)
Author:
vboxsync
Message:

Corrected selector bounds checking for expand down selectors in DBGFR3AddrFromSelOff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/DBGFAddr.cpp

    r4071 r4198  
    6363        if (VBOX_FAILURE(rc))
    6464            return rc;
    65         if (off > SelInfo.cbLimit)
     65
     66        /* check limit. */
     67        if (    (SelInfo.Raw.Gen.u4Type & X86_SEL_TYPE_DOWN)
     68            &&  SelInfo.Raw.Gen.u1DescType
     69            &&  (   SelInfo.Raw.Gen.u4Type == X86_SEL_TYPE_RO_DOWN
     70                 || SelInfo.Raw.Gen.u4Type == X86_SEL_TYPE_RO_DOWN_ACC
     71                 || SelInfo.Raw.Gen.u4Type == X86_SEL_TYPE_RW_DOWN
     72                 || SelInfo.Raw.Gen.u4Type == X86_SEL_TYPE_RW_DOWN_ACC))
     73        {
     74            if (!SelInfo.Raw.Gen.u1Granularity && off > UINT32_C(0xffff))
     75                return VERR_OUT_OF_SELECTOR_BOUNDS;
     76            if (off <= SelInfo.cbLimit)
     77                return VERR_OUT_OF_SELECTOR_BOUNDS;
     78        }
     79        else if (off > SelInfo.cbLimit)
    6680            return VERR_OUT_OF_SELECTOR_BOUNDS;
     81
    6782        pAddress->FlatPtr = SelInfo.GCPtrBase + off;
    6883        /** @todo fix this flat selector test! */
     
    7186            &&  SelInfo.Raw.Gen.u1DefBig)
    7287            pAddress->fFlags = DBGFADDRESS_FLAGS_FLAT;
    73         else if (SelInfo.cbLimit <= 0xffff)
     88        else if (SelInfo.cbLimit <= UINT32_C(0xffff))
    7489            pAddress->fFlags = DBGFADDRESS_FLAGS_FAR16;
    75         else if (SelInfo.cbLimit <= 0xffffffff)
     90        else if (SelInfo.cbLimit <= UINT32_C(0xffffffff))
    7691            pAddress->fFlags = DBGFADDRESS_FLAGS_FAR32;
    7792        else
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