crypto/objects/obj_dat.c:451: error: BUFFER_OVERRUN_L3
  Offset: [1, +oo] Size: [0, 8388607] by call to `BN_lshift`.
Showing all 12 steps of the trace


crypto/objects/obj_dat.c:451:22: Call
449.               }
450.               if (use_bn) {
451.                   if (!BN_lshift(bl, bl, 7))
                            ^
452.                       goto err;
453.               } else

crypto/bn/bn_shift.c:83:1: Parameter `r->top`
  81.   }
  82.   
  83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
  84.   {
  85.       int i, nw, lb, rb;

crypto/objects/obj_dat.c:451:22: Call
449.               }
450.               if (use_bn) {
451.                   if (!BN_lshift(bl, bl, 7))
                            ^
452.                       goto err;
453.               } else

crypto/bn/bn_shift.c:83:1: <Offset trace>
81.   }
82.   
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84.   {
85.       int i, nw, lb, rb;

crypto/bn/bn_shift.c:83:1: Parameter `n`
  81.   }
  82.   
  83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
  84.   {
  85.       int i, nw, lb, rb;

crypto/bn/bn_shift.c:97:5: Assignment
  95.       }
  96.   
  97.       nw = n / BN_BITS2;
             ^
  98.       if (bn_wexpand(r, a->top + nw + 1) == NULL)
  99.           return (0);

crypto/bn/bn_shift.c:83:1: <Length trace>
81.   }
82.   
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84.   {
85.       int i, nw, lb, rb;

crypto/bn/bn_shift.c:83:1: Parameter `*r->d`
  81.   }
  82.   
  83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
  84.   {
  85.       int i, nw, lb, rb;

crypto/bn/bn_shift.c:98:9: Call
  96.   
  97.       nw = n / BN_BITS2;
  98.       if (bn_wexpand(r, a->top + nw + 1) == NULL)
                 ^
  99.           return (0);
  100.       r->neg = a->neg;

crypto/bn/bn_lib.c:948:1: Parameter `*a->d`
    946.   }
    947.   
    948. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
    949.   {
    950.       return (words <= a->dmax) ? a : bn_expand2(a, words);

crypto/bn/bn_shift.c:104:5: Assignment
  102.       rb = BN_BITS2 - lb;
  103.       f = a->d;
  104.       t = r->d;
             ^
  105.       t[a->top + nw] = 0;
  106.       if (lb == 0)

crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_lshift` 
  110.           for (i = a->top - 1; i >= 0; i--) {
  111.               l = f[i];
  112.               t[nw + i + 1] |= (l >> rb) & BN_MASK2;
                     ^
  113.               t[nw + i] = (l << lb) & BN_MASK2;
  114.           }

int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
{
    int i, nw, lb, rb;
    BN_ULONG *t, *f;
    BN_ULONG l;
    bn_check_top(r);
    bn_check_top(a);
    if (n < 0) {
        BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT);
        return 0;
    }
    nw = n / BN_BITS2;
    if (bn_wexpand(r, a->top + nw + 1) == NULL)
        return (0);
    r->neg = a->neg;
    lb = n % BN_BITS2;
    rb = BN_BITS2 - lb;
    f = a->d;
    t = r->d;
    t[a->top + nw] = 0;
    if (lb == 0)
        for (i = a->top - 1; i >= 0; i--)
            t[nw + i] = f[i];
    else
        for (i = a->top - 1; i >= 0; i--) {
            l = f[i];
            t[nw + i + 1] |= (l >> rb) & BN_MASK2;
            t[nw + i] = (l << lb) & BN_MASK2;
        }
    memset(t, 0, sizeof(*t) * nw);
    r->top = a->top + nw + 1;
    bn_correct_top(r);
    bn_check_top(r);
    return (1);
}
['int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)\n{\n    int i, n = 0, len, nid, first, use_bn;\n    BIGNUM *bl;\n    unsigned long l;\n    const unsigned char *p;\n    char tbuf[DECIMAL_SIZE(i) + DECIMAL_SIZE(l) + 2];\n    if (buf && buf_len > 0)\n        buf[0] = \'\\0\';\n    if ((a == NULL) || (a->data == NULL))\n        return (0);\n    if (!no_name && (nid = OBJ_obj2nid(a)) != NID_undef) {\n        const char *s;\n        s = OBJ_nid2ln(nid);\n        if (s == NULL)\n            s = OBJ_nid2sn(nid);\n        if (s) {\n            if (buf)\n                OPENSSL_strlcpy(buf, s, buf_len);\n            n = strlen(s);\n            return n;\n        }\n    }\n    len = a->length;\n    p = a->data;\n    first = 1;\n    bl = NULL;\n    while (len > 0) {\n        l = 0;\n        use_bn = 0;\n        for (;;) {\n            unsigned char c = *p++;\n            len--;\n            if ((len == 0) && (c & 0x80))\n                goto err;\n            if (use_bn) {\n                if (!BN_add_word(bl, c & 0x7f))\n                    goto err;\n            } else\n                l |= c & 0x7f;\n            if (!(c & 0x80))\n                break;\n            if (!use_bn && (l > (ULONG_MAX >> 7L))) {\n                if (bl == NULL && (bl = BN_new()) == NULL)\n                    goto err;\n                if (!BN_set_word(bl, l))\n                    goto err;\n                use_bn = 1;\n            }\n            if (use_bn) {\n                if (!BN_lshift(bl, bl, 7))\n                    goto err;\n            } else\n                l <<= 7L;\n        }\n        if (first) {\n            first = 0;\n            if (l >= 80) {\n                i = 2;\n                if (use_bn) {\n                    if (!BN_sub_word(bl, 80))\n                        goto err;\n                } else\n                    l -= 80;\n            } else {\n                i = (int)(l / 40);\n                l -= (long)(i * 40);\n            }\n            if (buf && (buf_len > 1)) {\n                *buf++ = i + \'0\';\n                *buf = \'\\0\';\n                buf_len--;\n            }\n            n++;\n        }\n        if (use_bn) {\n            char *bndec;\n            bndec = BN_bn2dec(bl);\n            if (!bndec)\n                goto err;\n            i = strlen(bndec);\n            if (buf) {\n                if (buf_len > 1) {\n                    *buf++ = \'.\';\n                    *buf = \'\\0\';\n                    buf_len--;\n                }\n                OPENSSL_strlcpy(buf, bndec, buf_len);\n                if (i > buf_len) {\n                    buf += buf_len;\n                    buf_len = 0;\n                } else {\n                    buf += i;\n                    buf_len -= i;\n                }\n            }\n            n++;\n            n += i;\n            OPENSSL_free(bndec);\n        } else {\n            BIO_snprintf(tbuf, sizeof tbuf, ".%lu", l);\n            i = strlen(tbuf);\n            if (buf && (buf_len > 0)) {\n                OPENSSL_strlcpy(buf, tbuf, buf_len);\n                if (i > buf_len) {\n                    buf += buf_len;\n                    buf_len = 0;\n                } else {\n                    buf += i;\n                    buf_len -= i;\n                }\n            }\n            n += i;\n            l = 0;\n        }\n    }\n    BN_free(bl);\n    return n;\n err:\n    BN_free(bl);\n    return -1;\n}', 'int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)\n{\n    int i, nw, lb, rb;\n    BN_ULONG *t, *f;\n    BN_ULONG l;\n    bn_check_top(r);\n    bn_check_top(a);\n    if (n < 0) {\n        BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT);\n        return 0;\n    }\n    nw = n / BN_BITS2;\n    if (bn_wexpand(r, a->top + nw + 1) == NULL)\n        return (0);\n    r->neg = a->neg;\n    lb = n % BN_BITS2;\n    rb = BN_BITS2 - lb;\n    f = a->d;\n    t = r->d;\n    t[a->top + nw] = 0;\n    if (lb == 0)\n        for (i = a->top - 1; i >= 0; i--)\n            t[nw + i] = f[i];\n    else\n        for (i = a->top - 1; i >= 0; i--) {\n            l = f[i];\n            t[nw + i + 1] |= (l >> rb) & BN_MASK2;\n            t[nw + i] = (l << lb) & BN_MASK2;\n        }\n    memset(t, 0, sizeof(*t) * nw);\n    r->top = a->top + nw + 1;\n    bn_correct_top(r);\n    bn_check_top(r);\n    return (1);\n}', 'BIGNUM *bn_wexpand(BIGNUM *a, int words)\n{\n    return (words <= a->dmax) ? a : bn_expand2(a, words);\n}']