test/rsa_test.c:91: error: BUFFER_OVERRUN_L3
  Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bin2bn`.
Showing all 14 steps of the trace


test/rsa_test.c:91:5: Call
89.           "\xb0\x05\xc3\x9e\xd8\x27\x4a\x9d\xbf\xa8\x06\x71\x40\x94\x39\xd2";
90.   
91.       SetKey;
          ^
92.   }
93.   

crypto/bn/bn_lib.c:407:1: Parameter `*ret->d`
  405.   }
  406.   
  407. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
  408.   {
  409.       unsigned int i, m;

test/rsa_test.c:91:5: Call
89.           "\xb0\x05\xc3\x9e\xd8\x27\x4a\x9d\xbf\xa8\x06\x71\x40\x94\x39\xd2";
90.   
91.       SetKey;
          ^
92.   }
93.   

crypto/bn/bn_lib.c:407:1: Parameter `*ret->d`
  405.   }
  406.   
  407. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
  408.   {
  409.       unsigned int i, m;

crypto/bn/bn_lib.c:429:9: Call
  427.       i = ((n - 1) / BN_BYTES) + 1;
  428.       m = ((n - 1) % (BN_BYTES));
  429.       if (bn_wexpand(ret, (int)i) == NULL) {
                 ^
  430.           BN_free(bn);
  431.           return NULL;

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_lib.c:950:37: Call
    948.   BIGNUM *bn_wexpand(BIGNUM *a, int words)
    949.   {
    950.       return (words <= a->dmax) ? a : bn_expand2(a, words);
                                               ^
    951.   }
    952.   

crypto/bn/bn_lib.c:284:1: Parameter `*b->d`
      282.    */
      283.   
      284. > BIGNUM *bn_expand2(BIGNUM *b, int words)
      285.   {
      286.       bn_check_top(b);

crypto/bn/bn_lib.c:289:23: Call
      287.   
      288.       if (words > b->dmax) {
      289.           BN_ULONG *a = bn_expand_internal(b, words);
                                   ^
      290.           if (!a)
      291.               return NULL;

crypto/bn/bn_lib.c:246:1: <Offset trace>
244.   /* This is used by bn_expand2() */
245.   /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247.   {
248.       BN_ULONG *a = NULL;

crypto/bn/bn_lib.c:246:1: Parameter `b->top`
        244.   /* This is used by bn_expand2() */
        245.   /* The caller MUST check that words > b->dmax before calling this */
        246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
        247.   {
        248.       BN_ULONG *a = NULL;

crypto/bn/bn_lib.c:246:1: <Length trace>
244.   /* This is used by bn_expand2() */
245.   /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247.   {
248.       BN_ULONG *a = NULL;

crypto/bn/bn_lib.c:246:1: Parameter `*b->d`
        244.   /* This is used by bn_expand2() */
        245.   /* The caller MUST check that words > b->dmax before calling this */
        246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
        247.   {
        248.       BN_ULONG *a = NULL;

crypto/bn/bn_lib.c:271:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bin2bn` 
        269.       assert(b->top <= words);
        270.       if (b->top > 0)
        271.           memcpy(a, b->d, sizeof(*a) * b->top);
                       ^
        272.   
        273.       return a;

static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
    BN_ULONG *a = NULL;
    bn_check_top(b);
    if (words > (INT_MAX / (4 * BN_BITS2))) {
        BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
        return NULL;
    }
    if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
        BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
        return (NULL);
    }
    if (BN_get_flags(b, BN_FLG_SECURE))
        a = OPENSSL_secure_zalloc(words * sizeof(*a));
    else
        a = OPENSSL_zalloc(words * sizeof(*a));
    if (a == NULL) {
        BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
        return (NULL);
    }
    assert(b->top <= words);
    if (b->top > 0)
        memcpy(a, b->d, sizeof(*a) * b->top);
    return a;
}
['static int key1(RSA *key, unsigned char *c)\n{\n    static unsigned char n[] =\n        "\\x00\\xAA\\x36\\xAB\\xCE\\x88\\xAC\\xFD\\xFF\\x55\\x52\\x3C\\x7F\\xC4\\x52\\x3F"\n        "\\x90\\xEF\\xA0\\x0D\\xF3\\x77\\x4A\\x25\\x9F\\x2E\\x62\\xB4\\xC5\\xD9\\x9C\\xB5"\n        "\\xAD\\xB3\\x00\\xA0\\x28\\x5E\\x53\\x01\\x93\\x0E\\x0C\\x70\\xFB\\x68\\x76\\x93"\n        "\\x9C\\xE6\\x16\\xCE\\x62\\x4A\\x11\\xE0\\x08\\x6D\\x34\\x1E\\xBC\\xAC\\xA0\\xA1"\n        "\\xF5";\n    static unsigned char e[] = "\\x11";\n    static unsigned char d[] =\n        "\\x0A\\x03\\x37\\x48\\x62\\x64\\x87\\x69\\x5F\\x5F\\x30\\xBC\\x38\\xB9\\x8B\\x44"\n        "\\xC2\\xCD\\x2D\\xFF\\x43\\x40\\x98\\xCD\\x20\\xD8\\xA1\\x38\\xD0\\x90\\xBF\\x64"\n        "\\x79\\x7C\\x3F\\xA7\\xA2\\xCD\\xCB\\x3C\\xD1\\xE0\\xBD\\xBA\\x26\\x54\\xB4\\xF9"\n        "\\xDF\\x8E\\x8A\\xE5\\x9D\\x73\\x3D\\x9F\\x33\\xB3\\x01\\x62\\x4A\\xFD\\x1D\\x51";\n    static unsigned char p[] =\n        "\\x00\\xD8\\x40\\xB4\\x16\\x66\\xB4\\x2E\\x92\\xEA\\x0D\\xA3\\xB4\\x32\\x04\\xB5"\n        "\\xCF\\xCE\\x33\\x52\\x52\\x4D\\x04\\x16\\xA5\\xA4\\x41\\xE7\\x00\\xAF\\x46\\x12"\n        "\\x0D";\n    static unsigned char q[] =\n        "\\x00\\xC9\\x7F\\xB1\\xF0\\x27\\xF4\\x53\\xF6\\x34\\x12\\x33\\xEA\\xAA\\xD1\\xD9"\n        "\\x35\\x3F\\x6C\\x42\\xD0\\x88\\x66\\xB1\\xD0\\x5A\\x0F\\x20\\x35\\x02\\x8B\\x9D"\n        "\\x89";\n    static unsigned char dmp1[] =\n        "\\x59\\x0B\\x95\\x72\\xA2\\xC2\\xA9\\xC4\\x06\\x05\\x9D\\xC2\\xAB\\x2F\\x1D\\xAF"\n        "\\xEB\\x7E\\x8B\\x4F\\x10\\xA7\\x54\\x9E\\x8E\\xED\\xF5\\xB4\\xFC\\xE0\\x9E\\x05";\n    static unsigned char dmq1[] =\n        "\\x00\\x8E\\x3C\\x05\\x21\\xFE\\x15\\xE0\\xEA\\x06\\xA3\\x6F\\xF0\\xF1\\x0C\\x99"\n        "\\x52\\xC3\\x5B\\x7A\\x75\\x14\\xFD\\x32\\x38\\xB8\\x0A\\xAD\\x52\\x98\\x62\\x8D"\n        "\\x51";\n    static unsigned char iqmp[] =\n        "\\x36\\x3F\\xF7\\x18\\x9D\\xA8\\xE9\\x0B\\x1D\\x34\\x1F\\x71\\xD0\\x9B\\x76\\xA8"\n        "\\xA9\\x43\\xE1\\x1D\\x10\\xB2\\x4D\\x24\\x9F\\x2D\\xEA\\xFE\\xF8\\x0C\\x18\\x26";\n    static unsigned char ctext_ex[] =\n        "\\x1b\\x8f\\x05\\xf9\\xca\\x1a\\x79\\x52\\x6e\\x53\\xf3\\xcc\\x51\\x4f\\xdb\\x89"\n        "\\x2b\\xfb\\x91\\x93\\x23\\x1e\\x78\\xb9\\x92\\xe6\\x8d\\x50\\xa4\\x80\\xcb\\x52"\n        "\\x33\\x89\\x5c\\x74\\x95\\x8d\\x5d\\x02\\xab\\x8c\\x0f\\xd0\\x40\\xeb\\x58\\x44"\n        "\\xb0\\x05\\xc3\\x9e\\xd8\\x27\\x4a\\x9d\\xbf\\xa8\\x06\\x71\\x40\\x94\\x39\\xd2";\n    SetKey;\n}', 'BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)\n{\n    unsigned int i, m;\n    unsigned int n;\n    BN_ULONG l;\n    BIGNUM *bn = NULL;\n    if (ret == NULL)\n        ret = bn = BN_new();\n    if (ret == NULL)\n        return (NULL);\n    bn_check_top(ret);\n    for ( ; len > 0 && *s == 0; s++, len--)\n        continue;\n    n = len;\n    if (n == 0) {\n        ret->top = 0;\n        return (ret);\n    }\n    i = ((n - 1) / BN_BYTES) + 1;\n    m = ((n - 1) % (BN_BYTES));\n    if (bn_wexpand(ret, (int)i) == NULL) {\n        BN_free(bn);\n        return NULL;\n    }\n    ret->top = i;\n    ret->neg = 0;\n    l = 0;\n    while (n--) {\n        l = (l << 8L) | *(s++);\n        if (m-- == 0) {\n            ret->d[--i] = l;\n            l = 0;\n            m = BN_BYTES - 1;\n        }\n    }\n    bn_correct_top(ret);\n    return (ret);\n}', 'BIGNUM *bn_wexpand(BIGNUM *a, int words)\n{\n    return (words <= a->dmax) ? a : bn_expand2(a, words);\n}', 'BIGNUM *bn_expand2(BIGNUM *b, int words)\n{\n    bn_check_top(b);\n    if (words > b->dmax) {\n        BN_ULONG *a = bn_expand_internal(b, words);\n        if (!a)\n            return NULL;\n        if (b->d) {\n            OPENSSL_cleanse(b->d, b->dmax * sizeof(b->d[0]));\n            bn_free_d(b);\n        }\n        b->d = a;\n        b->dmax = words;\n    }\n    bn_check_top(b);\n    return b;\n}', 'static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)\n{\n    BN_ULONG *a = NULL;\n    bn_check_top(b);\n    if (words > (INT_MAX / (4 * BN_BITS2))) {\n        BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);\n        return NULL;\n    }\n    if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {\n        BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);\n        return (NULL);\n    }\n    if (BN_get_flags(b, BN_FLG_SECURE))\n        a = OPENSSL_secure_zalloc(words * sizeof(*a));\n    else\n        a = OPENSSL_zalloc(words * sizeof(*a));\n    if (a == NULL) {\n        BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);\n        return (NULL);\n    }\n    assert(b->top <= words);\n    if (b->top > 0)\n        memcpy(a, b->d, sizeof(*a) * b->top);\n    return a;\n}']