crypto/asn1/tasn_enc.c:167: error: INTEGER_OVERFLOW_L2
  ([2, 2147483646] + [0, 2147483644]):signed32 by call to `ASN1_object_size`.
Showing all 7 steps of the trace


crypto/asn1/tasn_enc.c:142:9: Assignment
140.               return seqcontlen;
141.           /* Otherwise carry on */
142.           seqcontlen = 0;
               ^
143.           /* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */
144.           if (tag == -1) {

crypto/asn1/tasn_enc.c:167:18: Call
165.           }
166.   
167.           seqlen = ASN1_object_size(ndef, seqcontlen, tag);
                        ^
168.           if (!out || seqlen == -1)
169.               return seqlen;

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, 2147483646] + [0, 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;
}
['int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out,\n                     const ASN1_ITEM *it, int tag, int aclass)\n{\n    const ASN1_TEMPLATE *tt = NULL;\n    int i, seqcontlen, seqlen, ndef = 1;\n    const ASN1_EXTERN_FUNCS *ef;\n    const ASN1_AUX *aux = it->funcs;\n    ASN1_aux_cb *asn1_cb = 0;\n    if ((it->itype != ASN1_ITYPE_PRIMITIVE) && !*pval)\n        return 0;\n    if (aux && aux->asn1_cb)\n        asn1_cb = aux->asn1_cb;\n    switch (it->itype) {\n    case ASN1_ITYPE_PRIMITIVE:\n        if (it->templates)\n            return asn1_template_ex_i2d(pval, out, it->templates,\n                                        tag, aclass);\n        return asn1_i2d_ex_primitive(pval, out, it, tag, aclass);\n    case ASN1_ITYPE_MSTRING:\n        return asn1_i2d_ex_primitive(pval, out, it, -1, aclass);\n    case ASN1_ITYPE_CHOICE:\n        if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it, NULL))\n            return 0;\n        i = asn1_get_choice_selector(pval, it);\n        if ((i >= 0) && (i < it->tcount)) {\n            ASN1_VALUE **pchval;\n            const ASN1_TEMPLATE *chtt;\n            chtt = it->templates + i;\n            pchval = asn1_get_field_ptr(pval, chtt);\n            return asn1_template_ex_i2d(pchval, out, chtt, -1, aclass);\n        }\n        if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it, NULL))\n            return 0;\n        break;\n    case ASN1_ITYPE_EXTERN:\n        ef = it->funcs;\n        return ef->asn1_ex_i2d(pval, out, it, tag, aclass);\n    case ASN1_ITYPE_NDEF_SEQUENCE:\n        if (aclass & ASN1_TFLG_NDEF)\n            ndef = 2;\n    case ASN1_ITYPE_SEQUENCE:\n        i = asn1_enc_restore(&seqcontlen, out, pval, it);\n        if (i < 0)\n            return 0;\n        if (i > 0)\n            return seqcontlen;\n        seqcontlen = 0;\n        if (tag == -1) {\n            tag = V_ASN1_SEQUENCE;\n            aclass = (aclass & ~ASN1_TFLG_TAG_CLASS)\n                | V_ASN1_UNIVERSAL;\n        }\n        if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it, NULL))\n            return 0;\n        for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {\n            const ASN1_TEMPLATE *seqtt;\n            ASN1_VALUE **pseqval;\n            int tmplen;\n            seqtt = asn1_do_adb(pval, tt, 1);\n            if (!seqtt)\n                return 0;\n            pseqval = asn1_get_field_ptr(pval, seqtt);\n            tmplen = asn1_template_ex_i2d(pseqval, NULL, seqtt, -1, aclass);\n            if (tmplen == -1 || (tmplen > INT_MAX - seqcontlen))\n                return -1;\n            seqcontlen += tmplen;\n        }\n        seqlen = ASN1_object_size(ndef, seqcontlen, tag);\n        if (!out || seqlen == -1)\n            return seqlen;\n        ASN1_put_object(out, ndef, seqcontlen, tag, aclass);\n        for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {\n            const ASN1_TEMPLATE *seqtt;\n            ASN1_VALUE **pseqval;\n            seqtt = asn1_do_adb(pval, tt, 1);\n            if (!seqtt)\n                return 0;\n            pseqval = asn1_get_field_ptr(pval, seqtt);\n            asn1_template_ex_i2d(pseqval, out, seqtt, -1, aclass);\n        }\n        if (ndef == 2)\n            ASN1_put_eoc(out);\n        if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it, NULL))\n            return 0;\n        return seqlen;\n    default:\n        return 0;\n    }\n    return 0;\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}']