crypto/dh/dhtest.c:505: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `BN_bin2bn`.
Showing all 7 steps of the trace


crypto/dh/dhtest.c:504:25: Call
502.               goto bad_err;
503.   
504.           dhA->priv_key = BN_bin2bn(td->xA, td->xA_len, NULL);
                               ^
505.           dhA->pub_key = BN_bin2bn(td->yA, td->yA_len, NULL);
506.   

crypto/bn/bn_lib.c:546:1: Parameter `*ret->d`
  544.   }
  545.   
  546. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
  547.   {
  548.       unsigned int i, m;

crypto/dh/dhtest.c:505:24: Call
503.   
504.           dhA->priv_key = BN_bin2bn(td->xA, td->xA_len, NULL);
505.           dhA->pub_key = BN_bin2bn(td->yA, td->yA_len, NULL);
                              ^
506.   
507.           dhB->priv_key = BN_bin2bn(td->xB, td->xB_len, NULL);

crypto/bn/bn_lib.c:546:1: <LHS trace>
544.   }
545.   
546. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
547.   {
548.       unsigned int i, m;

crypto/bn/bn_lib.c:546:1: Parameter `len`
  544.   }
  545.   
  546. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
  547.   {
  548.       unsigned int i, m;

crypto/bn/bn_lib.c:559:5: Assignment
  557.       bn_check_top(ret);
  558.       l = 0;
  559.       n = len;
             ^
  560.       if (n == 0) {
  561.           ret->top = 0;

crypto/bn/bn_lib.c:564:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_bin2bn` 
  562.           return (ret);
  563.       }
  564.       i = ((n - 1) / BN_BYTES) + 1;
             ^
  565.       m = ((n - 1) % (BN_BYTES));
  566.       if (bn_wexpand(ret, (int)i) == NULL) {

BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
{
    unsigned int i, m;
    unsigned int n;
    BN_ULONG l;
    BIGNUM *bn = NULL;
    if (ret == NULL)
        ret = bn = BN_new();
    if (ret == NULL)
        return (NULL);
    bn_check_top(ret);
    l = 0;
    n = len;
    if (n == 0) {
        ret->top = 0;
        return (ret);
    }
    i = ((n - 1) / BN_BYTES) + 1;
    m = ((n - 1) % (BN_BYTES));
    if (bn_wexpand(ret, (int)i) == NULL) {
        if (bn)
            BN_free(bn);
        return NULL;
    }
    ret->top = i;
    ret->neg = 0;
    while (n--) {
        l = (l << 8L) | *(s++);
        if (m-- == 0) {
            ret->d[--i] = l;
            l = 0;
            m = BN_BYTES - 1;
        }
    }
    bn_correct_top(ret);
    return (ret);
}
['static int run_rfc5114_tests(void)\n{\n    int i;\n    for (i = 0; i < (int)(sizeof(rfctd) / sizeof(rfc5114_td)); i++) {\n        DH *dhA, *dhB;\n        unsigned char *Z1 = NULL, *Z2 = NULL;\n        const rfc5114_td *td = rfctd + i;\n        dhA = td->get_param();\n        dhB = td->get_param();\n        if (!dhA || !dhB)\n            goto bad_err;\n        dhA->priv_key = BN_bin2bn(td->xA, td->xA_len, NULL);\n        dhA->pub_key = BN_bin2bn(td->yA, td->yA_len, NULL);\n        dhB->priv_key = BN_bin2bn(td->xB, td->xB_len, NULL);\n        dhB->pub_key = BN_bin2bn(td->yB, td->yB_len, NULL);\n        if (!dhA->priv_key || !dhA->pub_key\n            || !dhB->priv_key || !dhB->pub_key)\n            goto bad_err;\n        if ((td->Z_len != (size_t)DH_size(dhA))\n            || (td->Z_len != (size_t)DH_size(dhB)))\n            goto err;\n        Z1 = OPENSSL_malloc(DH_size(dhA));\n        Z2 = OPENSSL_malloc(DH_size(dhB));\n        if (!DH_compute_key(Z1, dhB->pub_key, dhA))\n            goto bad_err;\n        if (!DH_compute_key(Z2, dhA->pub_key, dhB))\n            goto bad_err;\n        if (memcmp(Z1, td->Z, td->Z_len))\n            goto err;\n        if (memcmp(Z2, td->Z, td->Z_len))\n            goto err;\n        printf("RFC5114 parameter test %d OK\\n", i + 1);\n        DH_free(dhA);\n        DH_free(dhB);\n        OPENSSL_free(Z1);\n        OPENSSL_free(Z2);\n    }\n    return 1;\n bad_err:\n    fprintf(stderr, "Initalisation error RFC5114 set %d\\n", i + 1);\n    ERR_print_errors_fp(stderr);\n    return 0;\n err:\n    fprintf(stderr, "Test failed RFC5114 set %d\\n", i + 1);\n    return 0;\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    l = 0;\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        if (bn)\n            BN_free(bn);\n        return NULL;\n    }\n    ret->top = i;\n    ret->neg = 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}']