crypto/bn/bn_print.c:97: error: BUFFER_OVERRUN_L2
  Offset: [0, 10000000000000000000] Size: 256 by call to `BN_div_word`.
Showing all 9 steps of the trace


crypto/bn/bn_print.c:97:19: Call
95.           i = 0;
96.           while (!BN_is_zero(t)) {
97.               *lp = BN_div_word(t, BN_DEC_CONV);
                         ^
98.               if (*lp == (BN_ULONG)-1)
99.                   goto err;

crypto/bn/bn_word.c:61:1: Parameter `w`
  59.   }
  60.   
  61. > BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w)
  62.   {
  63.       BN_ULONG ret = 0;

crypto/bn/bn_word.c:67:5: Assignment
  65.   
  66.       bn_check_top(a);
  67.       w &= BN_MASK2;
            ^
  68.   
  69.       if (!w)

crypto/bn/bn_word.c:76:20: Call
  74.   
  75.       /* normalize input (so bn_div_words doesn't complain) */
  76.       j = BN_BITS2 - BN_num_bits_word(w);
                           ^
  77.       w <<= j;
  78.       if (!BN_lshift(a, a, j))

crypto/bn/bn_lib.c:89:1: <Offset trace>
87.   }
88.   
89. > int BN_num_bits_word(BN_ULONG l)
90.   {
91.       static const unsigned char bits[256] = {

crypto/bn/bn_lib.c:89:1: Parameter `l`
    87.   }
    88.   
    89. > int BN_num_bits_word(BN_ULONG l)
    90.   {
    91.       static const unsigned char bits[256] = {

crypto/bn/bn_lib.c:91:5: <Length trace>
89.   int BN_num_bits_word(BN_ULONG l)
90.   {
91.       static const unsigned char bits[256] = {
          ^
92.           0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
93.           5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,

crypto/bn/bn_lib.c:91:5: Array declaration
    89.   int BN_num_bits_word(BN_ULONG l)
    90.   {
    91.       static const unsigned char bits[256] = {
              ^
    92.           0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
    93.           5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,

crypto/bn/bn_lib.c:114:25: Array access: Offset: [0, 10000000000000000000] Size: 256 by call to `BN_div_word` 
    112.           if (l & 0xffff000000000000L) {
    113.               if (l & 0xff00000000000000L) {
    114.                   return (bits[(int)(l >> 56)] + 56);
                                   ^
    115.               } else
    116.                   return (bits[(int)(l >> 48)] + 48);

int BN_num_bits_word(BN_ULONG l)
{
    static const unsigned char bits[256] = {
        0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
        5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
        6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
        6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
        7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
        7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
        7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
        7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
        8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
        8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
        8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
        8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
        8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
        8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
        8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
        8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
    };
#if defined(SIXTY_FOUR_BIT_LONG)
    if (l & 0xffffffff00000000L) {
        if (l & 0xffff000000000000L) {
            if (l & 0xff00000000000000L) {
                return (bits[(int)(l >> 56)] + 56);
            } else
                return (bits[(int)(l >> 48)] + 48);
        } else {
            if (l & 0x0000ff0000000000L) {
                return (bits[(int)(l >> 40)] + 40);
            } else
                return (bits[(int)(l >> 32)] + 32);
        }
    } else
#else
# ifdef SIXTY_FOUR_BIT
    if (l & 0xffffffff00000000LL) {
        if (l & 0xffff000000000000LL) {
            if (l & 0xff00000000000000LL) {
                return (bits[(int)(l >> 56)] + 56);
            } else
                return (bits[(int)(l >> 48)] + 48);
        } else {
            if (l & 0x0000ff0000000000LL) {
                return (bits[(int)(l >> 40)] + 40);
            } else
                return (bits[(int)(l >> 32)] + 32);
        }
    } else
# endif
#endif
    {
#if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)
        if (l & 0xffff0000L) {
            if (l & 0xff000000L)
                return (bits[(int)(l >> 24L)] + 24);
            else
                return (bits[(int)(l >> 16L)] + 16);
        } else
#endif
        {
#if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)
            if (l & 0xff00L)
                return (bits[(int)(l >> 8)] + 8);
            else
#endif
                return (bits[(int)(l)]);
        }
    }
}
["char *BN_bn2dec(const BIGNUM *a)\n{\n    int i = 0, num, ok = 0;\n    char *buf = NULL;\n    char *p;\n    BIGNUM *t = NULL;\n    BN_ULONG *bn_data = NULL, *lp;\n    int bn_data_num;\n    i = BN_num_bits(a) * 3;\n    num = (i / 10 + i / 1000 + 1) + 1;\n    bn_data_num = num / BN_DEC_NUM + 1;\n    bn_data = OPENSSL_malloc(bn_data_num * sizeof(BN_ULONG));\n    buf = OPENSSL_malloc(num + 3);\n    if ((buf == NULL) || (bn_data == NULL)) {\n        BNerr(BN_F_BN_BN2DEC, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    if ((t = BN_dup(a)) == NULL)\n        goto err;\n#define BUF_REMAIN (num+3 - (size_t)(p - buf))\n    p = buf;\n    lp = bn_data;\n    if (BN_is_zero(t)) {\n        *(p++) = '0';\n        *(p++) = '\\0';\n    } else {\n        if (BN_is_negative(t))\n            *p++ = '-';\n        i = 0;\n        while (!BN_is_zero(t)) {\n            *lp = BN_div_word(t, BN_DEC_CONV);\n            if (*lp == (BN_ULONG)-1)\n                goto err;\n            lp++;\n            if (lp - bn_data >= bn_data_num)\n                goto err;\n        }\n        lp--;\n        BIO_snprintf(p, BUF_REMAIN, BN_DEC_FMT1, *lp);\n        while (*p)\n            p++;\n        while (lp != bn_data) {\n            lp--;\n            BIO_snprintf(p, BUF_REMAIN, BN_DEC_FMT2, *lp);\n            while (*p)\n                p++;\n        }\n    }\n    ok = 1;\n err:\n    OPENSSL_free(bn_data);\n    BN_free(t);\n    if (ok)\n        return buf;\n    OPENSSL_free(buf);\n    return NULL;\n}", 'BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w)\n{\n    BN_ULONG ret = 0;\n    int i, j;\n    bn_check_top(a);\n    w &= BN_MASK2;\n    if (!w)\n        return (BN_ULONG)-1;\n    if (a->top == 0)\n        return 0;\n    j = BN_BITS2 - BN_num_bits_word(w);\n    w <<= j;\n    if (!BN_lshift(a, a, j))\n        return (BN_ULONG)-1;\n    for (i = a->top - 1; i >= 0; i--) {\n        BN_ULONG l, d;\n        l = a->d[i];\n        d = bn_div_words(ret, l, w);\n        ret = (l - ((d * w) & BN_MASK2)) & BN_MASK2;\n        a->d[i] = d;\n    }\n    if ((a->top > 0) && (a->d[a->top - 1] == 0))\n        a->top--;\n    ret >>= j;\n    bn_check_top(a);\n    return (ret);\n}', 'int BN_num_bits_word(BN_ULONG l)\n{\n    static const unsigned char bits[256] = {\n        0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,\n        5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,\n        6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,\n        6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,\n        7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,\n        7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,\n        7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,\n        7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,\n        8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,\n        8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,\n        8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,\n        8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,\n        8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,\n        8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,\n        8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,\n        8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,\n    };\n#if defined(SIXTY_FOUR_BIT_LONG)\n    if (l & 0xffffffff00000000L) {\n        if (l & 0xffff000000000000L) {\n            if (l & 0xff00000000000000L) {\n                return (bits[(int)(l >> 56)] + 56);\n            } else\n                return (bits[(int)(l >> 48)] + 48);\n        } else {\n            if (l & 0x0000ff0000000000L) {\n                return (bits[(int)(l >> 40)] + 40);\n            } else\n                return (bits[(int)(l >> 32)] + 32);\n        }\n    } else\n#else\n# ifdef SIXTY_FOUR_BIT\n    if (l & 0xffffffff00000000LL) {\n        if (l & 0xffff000000000000LL) {\n            if (l & 0xff00000000000000LL) {\n                return (bits[(int)(l >> 56)] + 56);\n            } else\n                return (bits[(int)(l >> 48)] + 48);\n        } else {\n            if (l & 0x0000ff0000000000LL) {\n                return (bits[(int)(l >> 40)] + 40);\n            } else\n                return (bits[(int)(l >> 32)] + 32);\n        }\n    } else\n# endif\n#endif\n    {\n#if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)\n        if (l & 0xffff0000L) {\n            if (l & 0xff000000L)\n                return (bits[(int)(l >> 24L)] + 24);\n            else\n                return (bits[(int)(l >> 16L)] + 16);\n        } else\n#endif\n        {\n#if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)\n            if (l & 0xff00L)\n                return (bits[(int)(l >> 8)] + 8);\n            else\n#endif\n                return (bits[(int)(l)]);\n        }\n    }\n}']