VirtualBox

Changeset 72367 in vbox for trunk/src


Ignore:
Timestamp:
May 28, 2018 6:05:58 PM (7 years ago)
Author:
vboxsync
Message:

Runtime: Updates bugref:9188

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/asn1/asn1-ut-integer-decode.cpp

    r69111 r72367  
    4949        if (RT_SUCCESS(rc))
    5050        {
    51             uint32_t offLast = pThis->Asn1Core.cb - 1;
    52             switch (pThis->Asn1Core.cb)
     51            if (pThis->Asn1Core.cb > 0)
    5352            {
    54                 default:
    55                 case 8: pThis->uValue.u |= (uint64_t)pThis->Asn1Core.uData.pu8[offLast - 7] << 56; RT_FALL_THRU();
    56                 case 7: pThis->uValue.u |= (uint64_t)pThis->Asn1Core.uData.pu8[offLast - 6] << 48; RT_FALL_THRU();
    57                 case 6: pThis->uValue.u |= (uint64_t)pThis->Asn1Core.uData.pu8[offLast - 5] << 40; RT_FALL_THRU();
    58                 case 5: pThis->uValue.u |= (uint64_t)pThis->Asn1Core.uData.pu8[offLast - 4] << 32; RT_FALL_THRU();
    59                 case 4: pThis->uValue.u |= (uint32_t)pThis->Asn1Core.uData.pu8[offLast - 3] << 24; RT_FALL_THRU();
    60                 case 3: pThis->uValue.u |= (uint32_t)pThis->Asn1Core.uData.pu8[offLast - 2] << 16; RT_FALL_THRU();
    61                 case 2: pThis->uValue.u |= (uint16_t)pThis->Asn1Core.uData.pu8[offLast - 1] <<  8; RT_FALL_THRU();
    62                 case 1: pThis->uValue.u |=           pThis->Asn1Core.uData.pu8[offLast];
     53                uint32_t offLast = pThis->Asn1Core.cb - 1;
     54                switch (pThis->Asn1Core.cb)
     55                {
     56                    default:
     57                    case 8: pThis->uValue.u |= (uint64_t)pThis->Asn1Core.uData.pu8[offLast - 7] << 56; RT_FALL_THRU();
     58                    case 7: pThis->uValue.u |= (uint64_t)pThis->Asn1Core.uData.pu8[offLast - 6] << 48; RT_FALL_THRU();
     59                    case 6: pThis->uValue.u |= (uint64_t)pThis->Asn1Core.uData.pu8[offLast - 5] << 40; RT_FALL_THRU();
     60                    case 5: pThis->uValue.u |= (uint64_t)pThis->Asn1Core.uData.pu8[offLast - 4] << 32; RT_FALL_THRU();
     61                    case 4: pThis->uValue.u |= (uint32_t)pThis->Asn1Core.uData.pu8[offLast - 3] << 24; RT_FALL_THRU();
     62                    case 3: pThis->uValue.u |= (uint32_t)pThis->Asn1Core.uData.pu8[offLast - 2] << 16; RT_FALL_THRU();
     63                    case 2: pThis->uValue.u |= (uint16_t)pThis->Asn1Core.uData.pu8[offLast - 1] <<  8; RT_FALL_THRU();
     64                    case 1: pThis->uValue.u |=           pThis->Asn1Core.uData.pu8[offLast];
     65                }
     66                RTAsn1CursorSkip(pCursor, pThis->Asn1Core.cb);
     67                pThis->Asn1Core.fFlags |= RTASN1CORE_F_PRIMITE_TAG_STRUCT;
     68                pThis->Asn1Core.pOps    = &g_RTAsn1Integer_Vtable;
     69                return VINF_SUCCESS;
    6370            }
    64             RTAsn1CursorSkip(pCursor, pThis->Asn1Core.cb);
    65             pThis->Asn1Core.fFlags |= RTASN1CORE_F_PRIMITE_TAG_STRUCT;
    66             pThis->Asn1Core.pOps    = &g_RTAsn1Integer_Vtable;
    67             return VINF_SUCCESS;
     71            else
     72                rc = RTAsn1CursorSetInfo(pCursor, VERR_ASN1_INVALID_INTEGER_ENCODING,
     73                                         "%s: Invalid integer length, exepcted more than 0: %#x",
     74                                         pszErrorTag, pThis->Asn1Core.cb);
    6875        }
    6976    }
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