VirtualBox

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


Ignore:
Timestamp:
Nov 16, 2007 6:55:05 PM (17 years ago)
Author:
vboxsync
Message:

Fixed some overflow detection issues.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/string/strtonum.cpp

    r5712 r5781  
    3939    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
    4040};
    41 /** Approximated overflow shift checks.
    42  * @todo make the overflow stuff work for real. */
     41/** Approximated overflow shift checks. */
    4342static const char g_auchShift[36] =
    4443{
    4544  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35 */
    46      64, 64, 63, 63, 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 57, 57, 56, 56, 55, 55, 54, 54, 53, 53, 52, 52, 51, 51, 50, 50, 49, 49, 50, 50, 51, 51
     45     64, 64, 63, 63, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59
    4746};
    4847
     
    573572     * Note: We only support ascii digits at this time... :-)
    574573     */
    575     //int             iShift = g_auchShift[uBase];
     574    int             iShift = g_auchShift[uBase]; /** @todo test this, it's probably not 100% right yet. */
    576575    pszValue = psz; /* (Prefix and sign doesn't count in the digit counting.) */
    577576    int             rc = VINF_SUCCESS;
     
    587586        i64 *= uBase;
    588587        i64 += chDigit;
    589         if (i64Prev > i64/* || (i64Prev >> iShift)*/)
     588        if (i64Prev > i64 || (i64Prev >> iShift))
    590589            rc = VWRN_NUMBER_TOO_BIG;
    591590        psz++;
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