crypto/asn1/a_object.c:132: error: INTEGER_OVERFLOW_L2
  (0 - [0, 128]):unsigned64 by call to `BN_div_word`.
Showing all 8 steps of the trace


crypto/asn1/a_object.c:132:30: Call
130.               }
131.               while (blsize--) {
132.                   BN_ULONG t = BN_div_word(bl, 0x80L);
                                    ^
133.                   if (t == (BN_ULONG)-1)
134.                       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: <RHS trace>
87.   }
88.   
89. > int BN_num_bits_word(BN_ULONG l)
90.   {
91.       BN_ULONG x, mask;

crypto/bn/bn_lib.c:89:1: Parameter `l`
    87.   }
    88.   
    89. > int BN_num_bits_word(BN_ULONG l)
    90.   {
    91.       BN_ULONG x, mask;

crypto/bn/bn_lib.c:95:5: Assignment
    93.   
    94.   #if BN_BITS2 > 32
    95.       x = l >> 32;
              ^
    96.       mask = (0 - x) & BN_MASK2;
    97.       mask = (0 - (mask >> (BN_BITS2 - 1)));

crypto/bn/bn_lib.c:96:5: Binary operation: (0 - [0, 128]):unsigned64 by call to `BN_div_word` 
    94.   #if BN_BITS2 > 32
    95.       x = l >> 32;
    96.       mask = (0 - x) & BN_MASK2;
              ^
    97.       mask = (0 - (mask >> (BN_BITS2 - 1)));
    98.       bits += 32 & mask;

int BN_num_bits_word(BN_ULONG l)
{
    BN_ULONG x, mask;
    int bits = (l != 0);
#if BN_BITS2 > 32
    x = l >> 32;
    mask = (0 - x) & BN_MASK2;
    mask = (0 - (mask >> (BN_BITS2 - 1)));
    bits += 32 & mask;
    l ^= (x ^ l) & mask;
#endif
    x = l >> 16;
    mask = (0 - x) & BN_MASK2;
    mask = (0 - (mask >> (BN_BITS2 - 1)));
    bits += 16 & mask;
    l ^= (x ^ l) & mask;
    x = l >> 8;
    mask = (0 - x) & BN_MASK2;
    mask = (0 - (mask >> (BN_BITS2 - 1)));
    bits += 8 & mask;
    l ^= (x ^ l) & mask;
    x = l >> 4;
    mask = (0 - x) & BN_MASK2;
    mask = (0 - (mask >> (BN_BITS2 - 1)));
    bits += 4 & mask;
    l ^= (x ^ l) & mask;
    x = l >> 2;
    mask = (0 - x) & BN_MASK2;
    mask = (0 - (mask >> (BN_BITS2 - 1)));
    bits += 2 & mask;
    l ^= (x ^ l) & mask;
    x = l >> 1;
    mask = (0 - x) & BN_MASK2;
    mask = (0 - (mask >> (BN_BITS2 - 1)));
    bits += 1 & mask;
    return bits;
}
["int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)\n{\n    int i, first, len = 0, c, use_bn;\n    char ftmp[24], *tmp = ftmp;\n    int tmpsize = sizeof(ftmp);\n    const char *p;\n    unsigned long l;\n    BIGNUM *bl = NULL;\n    if (num == 0)\n        return 0;\n    else if (num == -1)\n        num = strlen(buf);\n    p = buf;\n    c = *(p++);\n    num--;\n    if ((c >= '0') && (c <= '2')) {\n        first = c - '0';\n    } else {\n        ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_FIRST_NUM_TOO_LARGE);\n        goto err;\n    }\n    if (num <= 0) {\n        ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_MISSING_SECOND_NUMBER);\n        goto err;\n    }\n    c = *(p++);\n    num--;\n    for (;;) {\n        if (num <= 0)\n            break;\n        if ((c != '.') && (c != ' ')) {\n            ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_INVALID_SEPARATOR);\n            goto err;\n        }\n        l = 0;\n        use_bn = 0;\n        for (;;) {\n            if (num <= 0)\n                break;\n            num--;\n            c = *(p++);\n            if ((c == ' ') || (c == '.'))\n                break;\n            if (!ossl_isdigit(c)) {\n                ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_INVALID_DIGIT);\n                goto err;\n            }\n            if (!use_bn && l >= ((ULONG_MAX - 80) / 10L)) {\n                use_bn = 1;\n                if (bl == NULL)\n                    bl = BN_new();\n                if (bl == NULL || !BN_set_word(bl, l))\n                    goto err;\n            }\n            if (use_bn) {\n                if (!BN_mul_word(bl, 10L)\n                    || !BN_add_word(bl, c - '0'))\n                    goto err;\n            } else\n                l = l * 10L + (long)(c - '0');\n        }\n        if (len == 0) {\n            if ((first < 2) && (l >= 40)) {\n                ASN1err(ASN1_F_A2D_ASN1_OBJECT,\n                        ASN1_R_SECOND_NUMBER_TOO_LARGE);\n                goto err;\n            }\n            if (use_bn) {\n                if (!BN_add_word(bl, first * 40))\n                    goto err;\n            } else\n                l += (long)first *40;\n        }\n        i = 0;\n        if (use_bn) {\n            int blsize;\n            blsize = BN_num_bits(bl);\n            blsize = (blsize + 6) / 7;\n            if (blsize > tmpsize) {\n                if (tmp != ftmp)\n                    OPENSSL_free(tmp);\n                tmpsize = blsize + 32;\n                tmp = OPENSSL_malloc(tmpsize);\n                if (tmp == NULL)\n                    goto err;\n            }\n            while (blsize--) {\n                BN_ULONG t = BN_div_word(bl, 0x80L);\n                if (t == (BN_ULONG)-1)\n                    goto err;\n                tmp[i++] = (unsigned char)t;\n            }\n        } else {\n            for (;;) {\n                tmp[i++] = (unsigned char)l & 0x7f;\n                l >>= 7L;\n                if (l == 0L)\n                    break;\n            }\n        }\n        if (out != NULL) {\n            if (len + i > olen) {\n                ASN1err(ASN1_F_A2D_ASN1_OBJECT, ASN1_R_BUFFER_TOO_SMALL);\n                goto err;\n            }\n            while (--i > 0)\n                out[len++] = tmp[i] | 0x80;\n            out[len++] = tmp[0];\n        } else\n            len += i;\n    }\n    if (tmp != ftmp)\n        OPENSSL_free(tmp);\n    BN_free(bl);\n    return len;\n err:\n    if (tmp != ftmp)\n        OPENSSL_free(tmp);\n    BN_free(bl);\n    return 0;\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    if (!a->top)\n        a->neg = 0;\n    bn_check_top(a);\n    return ret;\n}', 'int BN_num_bits_word(BN_ULONG l)\n{\n    BN_ULONG x, mask;\n    int bits = (l != 0);\n#if BN_BITS2 > 32\n    x = l >> 32;\n    mask = (0 - x) & BN_MASK2;\n    mask = (0 - (mask >> (BN_BITS2 - 1)));\n    bits += 32 & mask;\n    l ^= (x ^ l) & mask;\n#endif\n    x = l >> 16;\n    mask = (0 - x) & BN_MASK2;\n    mask = (0 - (mask >> (BN_BITS2 - 1)));\n    bits += 16 & mask;\n    l ^= (x ^ l) & mask;\n    x = l >> 8;\n    mask = (0 - x) & BN_MASK2;\n    mask = (0 - (mask >> (BN_BITS2 - 1)));\n    bits += 8 & mask;\n    l ^= (x ^ l) & mask;\n    x = l >> 4;\n    mask = (0 - x) & BN_MASK2;\n    mask = (0 - (mask >> (BN_BITS2 - 1)));\n    bits += 4 & mask;\n    l ^= (x ^ l) & mask;\n    x = l >> 2;\n    mask = (0 - x) & BN_MASK2;\n    mask = (0 - (mask >> (BN_BITS2 - 1)));\n    bits += 2 & mask;\n    l ^= (x ^ l) & mask;\n    x = l >> 1;\n    mask = (0 - x) & BN_MASK2;\n    mask = (0 - (mask >> (BN_BITS2 - 1)));\n    bits += 1 & mask;\n    return bits;\n}']