test/rsa_test.c:208: 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:208:5: Call
206.           "\xc4\x56\xb4\xf5\x9f\x7b\x62\x1e\xa1\xb9\xd8\x8f\x64\x20\x2f\xb1";
207.   
208.       SetKey;
           ^
209.   }
210.   

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:208:5: Call
206.           "\xc4\x56\xb4\xf5\x9f\x7b\x62\x1e\xa1\xb9\xd8\x8f\x64\x20\x2f\xb1";
207.   
208.       SetKey;
           ^
209.   }
210.   

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 key3(RSA *key, unsigned char *c)\n{\n    static unsigned char n[] =\n        "\\x00\\xBB\\xF8\\x2F\\x09\\x06\\x82\\xCE\\x9C\\x23\\x38\\xAC\\x2B\\x9D\\xA8\\x71"\n        "\\xF7\\x36\\x8D\\x07\\xEE\\xD4\\x10\\x43\\xA4\\x40\\xD6\\xB6\\xF0\\x74\\x54\\xF5"\n        "\\x1F\\xB8\\xDF\\xBA\\xAF\\x03\\x5C\\x02\\xAB\\x61\\xEA\\x48\\xCE\\xEB\\x6F\\xCD"\n        "\\x48\\x76\\xED\\x52\\x0D\\x60\\xE1\\xEC\\x46\\x19\\x71\\x9D\\x8A\\x5B\\x8B\\x80"\n        "\\x7F\\xAF\\xB8\\xE0\\xA3\\xDF\\xC7\\x37\\x72\\x3E\\xE6\\xB4\\xB7\\xD9\\x3A\\x25"\n        "\\x84\\xEE\\x6A\\x64\\x9D\\x06\\x09\\x53\\x74\\x88\\x34\\xB2\\x45\\x45\\x98\\x39"\n        "\\x4E\\xE0\\xAA\\xB1\\x2D\\x7B\\x61\\xA5\\x1F\\x52\\x7A\\x9A\\x41\\xF6\\xC1\\x68"\n        "\\x7F\\xE2\\x53\\x72\\x98\\xCA\\x2A\\x8F\\x59\\x46\\xF8\\xE5\\xFD\\x09\\x1D\\xBD"\n        "\\xCB";\n    static unsigned char e[] = "\\x11";\n    static unsigned char d[] =\n        "\\x00\\xA5\\xDA\\xFC\\x53\\x41\\xFA\\xF2\\x89\\xC4\\xB9\\x88\\xDB\\x30\\xC1\\xCD"\n        "\\xF8\\x3F\\x31\\x25\\x1E\\x06\\x68\\xB4\\x27\\x84\\x81\\x38\\x01\\x57\\x96\\x41"\n        "\\xB2\\x94\\x10\\xB3\\xC7\\x99\\x8D\\x6B\\xC4\\x65\\x74\\x5E\\x5C\\x39\\x26\\x69"\n        "\\xD6\\x87\\x0D\\xA2\\xC0\\x82\\xA9\\x39\\xE3\\x7F\\xDC\\xB8\\x2E\\xC9\\x3E\\xDA"\n        "\\xC9\\x7F\\xF3\\xAD\\x59\\x50\\xAC\\xCF\\xBC\\x11\\x1C\\x76\\xF1\\xA9\\x52\\x94"\n        "\\x44\\xE5\\x6A\\xAF\\x68\\xC5\\x6C\\x09\\x2C\\xD3\\x8D\\xC3\\xBE\\xF5\\xD2\\x0A"\n        "\\x93\\x99\\x26\\xED\\x4F\\x74\\xA1\\x3E\\xDD\\xFB\\xE1\\xA1\\xCE\\xCC\\x48\\x94"\n        "\\xAF\\x94\\x28\\xC2\\xB7\\xB8\\x88\\x3F\\xE4\\x46\\x3A\\x4B\\xC8\\x5B\\x1C\\xB3"\n        "\\xC1";\n    static unsigned char p[] =\n        "\\x00\\xEE\\xCF\\xAE\\x81\\xB1\\xB9\\xB3\\xC9\\x08\\x81\\x0B\\x10\\xA1\\xB5\\x60"\n        "\\x01\\x99\\xEB\\x9F\\x44\\xAE\\xF4\\xFD\\xA4\\x93\\xB8\\x1A\\x9E\\x3D\\x84\\xF6"\n        "\\x32\\x12\\x4E\\xF0\\x23\\x6E\\x5D\\x1E\\x3B\\x7E\\x28\\xFA\\xE7\\xAA\\x04\\x0A"\n        "\\x2D\\x5B\\x25\\x21\\x76\\x45\\x9D\\x1F\\x39\\x75\\x41\\xBA\\x2A\\x58\\xFB\\x65"\n        "\\x99";\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        "\\x86\\x98\\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\\x15"\n        "\\x03";\n    static unsigned char dmp1[] =\n        "\\x54\\x49\\x4C\\xA6\\x3E\\xBA\\x03\\x37\\xE4\\xE2\\x40\\x23\\xFC\\xD6\\x9A\\x5A"\n        "\\xEB\\x07\\xDD\\xDC\\x01\\x83\\xA4\\xD0\\xAC\\x9B\\x54\\xB0\\x51\\xF2\\xB1\\x3E"\n        "\\xD9\\x49\\x09\\x75\\xEA\\xB7\\x74\\x14\\xFF\\x59\\xC1\\xF7\\x69\\x2E\\x9A\\x2E"\n        "\\x20\\x2B\\x38\\xFC\\x91\\x0A\\x47\\x41\\x74\\xAD\\xC9\\x3C\\x1F\\x67\\xC9\\x81";\n    static unsigned char dmq1[] =\n        "\\x47\\x1E\\x02\\x90\\xFF\\x0A\\xF0\\x75\\x03\\x51\\xB7\\xF8\\x78\\x86\\x4C\\xA9"\n        "\\x61\\xAD\\xBD\\x3A\\x8A\\x7E\\x99\\x1C\\x5C\\x05\\x56\\xA9\\x4C\\x31\\x46\\xA7"\n        "\\xF9\\x80\\x3F\\x8F\\x6F\\x8A\\xE3\\x42\\xE9\\x31\\xFD\\x8A\\xE4\\x7A\\x22\\x0D"\n        "\\x1B\\x99\\xA4\\x95\\x84\\x98\\x07\\xFE\\x39\\xF9\\x24\\x5A\\x98\\x36\\xDA\\x3D";\n    static unsigned char iqmp[] =\n        "\\x00\\xB0\\x6C\\x4F\\xDA\\xBB\\x63\\x01\\x19\\x8D\\x26\\x5B\\xDB\\xAE\\x94\\x23"\n        "\\xB3\\x80\\xF2\\x71\\xF7\\x34\\x53\\x88\\x50\\x93\\x07\\x7F\\xCD\\x39\\xE2\\x11"\n        "\\x9F\\xC9\\x86\\x32\\x15\\x4F\\x58\\x83\\xB1\\x67\\xA9\\x67\\xBF\\x40\\x2B\\x4E"\n        "\\x9E\\x2E\\x0F\\x96\\x56\\xE6\\x98\\xEA\\x36\\x66\\xED\\xFB\\x25\\x79\\x80\\x39"\n        "\\xF7";\n    static unsigned char ctext_ex[] =\n        "\\xb8\\x24\\x6b\\x56\\xa6\\xed\\x58\\x81\\xae\\xb5\\x85\\xd9\\xa2\\x5b\\x2a\\xd7"\n        "\\x90\\xc4\\x17\\xe0\\x80\\x68\\x1b\\xf1\\xac\\x2b\\xc3\\xde\\xb6\\x9d\\x8b\\xce"\n        "\\xf0\\xc4\\x36\\x6f\\xec\\x40\\x0a\\xf0\\x52\\xa7\\x2e\\x9b\\x0e\\xff\\xb5\\xb3"\n        "\\xf2\\xf1\\x92\\xdb\\xea\\xca\\x03\\xc1\\x27\\x40\\x05\\x71\\x13\\xbf\\x1f\\x06"\n        "\\x69\\xac\\x22\\xe9\\xf3\\xa7\\x85\\x2e\\x3c\\x15\\xd9\\x13\\xca\\xb0\\xb8\\x86"\n        "\\x3a\\x95\\xc9\\x92\\x94\\xce\\x86\\x74\\x21\\x49\\x54\\x61\\x03\\x46\\xf4\\xd4"\n        "\\x74\\xb2\\x6f\\x7c\\x48\\xb4\\x2e\\xe6\\x8e\\x1f\\x57\\x2a\\x1f\\xc4\\x02\\x6a"\n        "\\xc4\\x56\\xb4\\xf5\\x9f\\x7b\\x62\\x1e\\xa1\\xb9\\xd8\\x8f\\x64\\x20\\x2f\\xb1";\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}']