crypto/ocsp/ocsp_ext.c:258: error: INTEGER_OVERFLOW_L2
  ([2, 2147483645] + [1, 2147483644]):signed32 by call to `ASN1_object_size`.
Showing all 7 steps of the trace


crypto/ocsp/ocsp_ext.c:244:1: Parameter `len`
242.    */
243.   
244. > static int ocsp_add1_nonce(STACK_OF(X509_EXTENSION) **exts,
245.                              unsigned char *val, int len)
246.   {

crypto/ocsp/ocsp_ext.c:258:17: Call
256.        * relies on library internals.
257.        */
258.       os.length = ASN1_object_size(0, len, V_ASN1_OCTET_STRING);
                       ^
259.       if (os.length < 0)
260.           goto err;

crypto/asn1/asn1_lib.c:207:1: <LHS trace>
205.   }
206.   
207. > int ASN1_object_size(int constructed, int length, int tag)
208.   {
209.       int ret = 1;

crypto/asn1/asn1_lib.c:207:1: Parameter `length`
  205.   }
  206.   
  207. > int ASN1_object_size(int constructed, int length, int tag)
  208.   {
  209.       int ret = 1;

crypto/asn1/asn1_lib.c:207:1: <RHS trace>
205.   }
206.   
207. > int ASN1_object_size(int constructed, int length, int tag)
208.   {
209.       int ret = 1;

crypto/asn1/asn1_lib.c:207:1: Parameter `length`
  205.   }
  206.   
  207. > int ASN1_object_size(int constructed, int length, int tag)
  208.   {
  209.       int ret = 1;

crypto/asn1/asn1_lib.c:232:5: Binary operation: ([2, 2147483645] + [1, 2147483644]):signed32 by call to `ASN1_object_size` 
  230.       if (ret >= INT_MAX - length)
  231.           return -1;
  232.       return ret + length;
             ^
  233.   }
  234.   

int ASN1_object_size(int constructed, int length, int tag)
{
    int ret = 1;
    if (length < 0)
        return -1;
    if (tag >= 31) {
        while (tag > 0) {
            tag >>= 7;
            ret++;
        }
    }
    if (constructed == 2) {
        ret += 3;
    } else {
        ret++;
        if (length > 127) {
            int tmplen = length;
            while (tmplen > 0) {
                tmplen >>= 8;
                ret++;
            }
        }
    }
    if (ret >= INT_MAX - length)
        return -1;
    return ret + length;
}
['static int ocsp_add1_nonce(STACK_OF(X509_EXTENSION) **exts,\n                           unsigned char *val, int len)\n{\n    unsigned char *tmpval;\n    ASN1_OCTET_STRING os;\n    int ret = 0;\n    if (len <= 0)\n        len = OCSP_DEFAULT_NONCE_LENGTH;\n    os.length = ASN1_object_size(0, len, V_ASN1_OCTET_STRING);\n    if (os.length < 0)\n        goto err;\n    os.data = OPENSSL_malloc(os.length);\n    if (os.data == NULL)\n        goto err;\n    tmpval = os.data;\n    ASN1_put_object(&tmpval, 0, len, V_ASN1_OCTET_STRING, V_ASN1_UNIVERSAL);\n    if (val)\n        memcpy(tmpval, val, len);\n    else if (RAND_bytes(tmpval, len) <= 0)\n        goto err;\n    if (!X509V3_add1_i2d(exts, NID_id_pkix_OCSP_Nonce,\n                         &os, 0, X509V3_ADD_REPLACE))\n        goto err;\n    ret = 1;\n err:\n    OPENSSL_free(os.data);\n    return ret;\n}', 'int ASN1_object_size(int constructed, int length, int tag)\n{\n    int ret = 1;\n    if (length < 0)\n        return -1;\n    if (tag >= 31) {\n        while (tag > 0) {\n            tag >>= 7;\n            ret++;\n        }\n    }\n    if (constructed == 2) {\n        ret += 3;\n    } else {\n        ret++;\n        if (length > 127) {\n            int tmplen = length;\n            while (tmplen > 0) {\n                tmplen >>= 8;\n                ret++;\n            }\n        }\n    }\n    if (ret >= INT_MAX - length)\n        return -1;\n    return ret + length;\n}']