crypto/bn/bn_shift.c:127: error: INTEGER_OVERFLOW_L2
  (0 - [0, 63]):unsigned64.
Showing all 6 steps of the trace


crypto/bn/bn_shift.c:107:1: <RHS trace>
105.    * non-secret.
106.    */
107. > int bn_lshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n)
108.   {
109.       int i, nw;

crypto/bn/bn_shift.c:107:1: Parameter `n`
105.    * non-secret.
106.    */
107. > int bn_lshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n)
108.   {
109.       int i, nw;

crypto/bn/bn_shift.c:124:9: Assignment
122.   
123.       if (a->top != 0) {
124.           lb = (unsigned int)n % BN_BITS2;
               ^
125.           rb = BN_BITS2 - lb;
126.           rb %= BN_BITS2;            /* say no to undefined behaviour */

crypto/bn/bn_shift.c:125:9: Assignment
123.       if (a->top != 0) {
124.           lb = (unsigned int)n % BN_BITS2;
125.           rb = BN_BITS2 - lb;
               ^
126.           rb %= BN_BITS2;            /* say no to undefined behaviour */
127.           rmask = (BN_ULONG)0 - rb;  /* rmask = 0 - (rb != 0) */

crypto/bn/bn_shift.c:126:9: Assignment
124.           lb = (unsigned int)n % BN_BITS2;
125.           rb = BN_BITS2 - lb;
126.           rb %= BN_BITS2;            /* say no to undefined behaviour */
               ^
127.           rmask = (BN_ULONG)0 - rb;  /* rmask = 0 - (rb != 0) */
128.           rmask |= rmask >> 8;

crypto/bn/bn_shift.c:127:9: Binary operation: (0 - [0, 63]):unsigned64
125.           rb = BN_BITS2 - lb;
126.           rb %= BN_BITS2;            /* say no to undefined behaviour */
127.           rmask = (BN_ULONG)0 - rb;  /* rmask = 0 - (rb != 0) */
               ^
128.           rmask |= rmask >> 8;
129.           f = &(a->d[0]);

int bn_lshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n)
{
    int i, nw;
    unsigned int lb, rb;
    BN_ULONG *t, *f;
    BN_ULONG l, m, rmask = 0;
    assert(n >= 0);
    bn_check_top(r);
    bn_check_top(a);
    nw = n / BN_BITS2;
    if (bn_wexpand(r, a->top + nw + 1) == NULL)
        return 0;
    if (a->top != 0) {
        lb = (unsigned int)n % BN_BITS2;
        rb = BN_BITS2 - lb;
        rb %= BN_BITS2;
        rmask = (BN_ULONG)0 - rb;
        rmask |= rmask >> 8;
        f = &(a->d[0]);
        t = &(r->d[nw]);
        l = f[a->top - 1];
        t[a->top] = (l >> rb) & rmask;
        for (i = a->top - 1; i > 0; i--) {
            m = l << lb;
            l = f[i - 1];
            t[i] = (m | ((l >> rb) & rmask)) & BN_MASK2;
        }
        t[0] = (l << lb) & BN_MASK2;
    } else {
        r->d[nw] = 0;
    }
    if (nw != 0)
        memset(r->d, 0, sizeof(*t) * nw);
    r->neg = a->neg;
    r->top = a->top + nw + 1;
    r->flags |= BN_FLG_FIXED_TOP;
    return 1;
}
['int bn_lshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n)\n{\n    int i, nw;\n    unsigned int lb, rb;\n    BN_ULONG *t, *f;\n    BN_ULONG l, m, rmask = 0;\n    assert(n >= 0);\n    bn_check_top(r);\n    bn_check_top(a);\n    nw = n / BN_BITS2;\n    if (bn_wexpand(r, a->top + nw + 1) == NULL)\n        return 0;\n    if (a->top != 0) {\n        lb = (unsigned int)n % BN_BITS2;\n        rb = BN_BITS2 - lb;\n        rb %= BN_BITS2;\n        rmask = (BN_ULONG)0 - rb;\n        rmask |= rmask >> 8;\n        f = &(a->d[0]);\n        t = &(r->d[nw]);\n        l = f[a->top - 1];\n        t[a->top] = (l >> rb) & rmask;\n        for (i = a->top - 1; i > 0; i--) {\n            m = l << lb;\n            l = f[i - 1];\n            t[i] = (m | ((l >> rb) & rmask)) & BN_MASK2;\n        }\n        t[0] = (l << lb) & BN_MASK2;\n    } else {\n        r->d[nw] = 0;\n    }\n    if (nw != 0)\n        memset(r->d, 0, sizeof(*t) * nw);\n    r->neg = a->neg;\n    r->top = a->top + nw + 1;\n    r->flags |= BN_FLG_FIXED_TOP;\n    return 1;\n}']