crypto/x509/x_name.c:414: error: BUFFER_OVERRUN_L1
  Offset: -1 Size: [0, +oo].
Showing all 7 steps of the trace


crypto/x509/x_name.c:389:19: <Length trace>
387.   
388.       out->type = V_ASN1_UTF8STRING;
389.       out->length = ASN1_STRING_to_UTF8(&out->data, in);
                         ^
390.       if (out->length == -1)
391.           return 0;

crypto/x509/x_name.c:389:19: Call
387.   
388.       out->type = V_ASN1_UTF8STRING;
389.       out->length = ASN1_STRING_to_UTF8(&out->data, in);
                         ^
390.       if (out->length == -1)
391.           return 0;

crypto/asn1/a_strex.c:577:9: Assignment
  575.       int mbflag, type, ret;
  576.       if (!in)
  577.           return -1;
                 ^
  578.       type = in->type;
  579.       if ((type < 0) || (type > 30))

crypto/x509/x_name.c:389:5: Assignment
387.   
388.       out->type = V_ASN1_UTF8STRING;
389.       out->length = ASN1_STRING_to_UTF8(&out->data, in);
           ^
390.       if (out->length == -1)
391.           return 0;

crypto/x509/x_name.c:396:5: Assignment
394.       from = to;
395.   
396.       len = out->length;
           ^
397.   
398.       /*

crypto/x509/x_name.c:411:5: Assignment
409.       }
410.   
411.       to = from + len;
           ^
412.   
413.       /* Ignore trailing spaces */

crypto/x509/x_name.c:414:23: Array access: Offset: -1 Size: [0, +oo]
412.   
413.       /* Ignore trailing spaces */
414.       while (len > 0 && ossl_isspace(to[-1])) {
                             ^
415.           to--;
416.           len--;

static int asn1_string_canon(ASN1_STRING *out, const ASN1_STRING *in)
{
    unsigned char *to, *from;
    int len, i;
    if (!(ASN1_tag2bit(in->type) & ASN1_MASK_CANON)) {
        if (!ASN1_STRING_copy(out, in))
            return 0;
        return 1;
    }
    out->type = V_ASN1_UTF8STRING;
    out->length = ASN1_STRING_to_UTF8(&out->data, in);
    if (out->length == -1)
        return 0;
    to = out->data;
    from = to;
    len = out->length;
    while (len > 0 && ossl_isspace(*from)) {
        from++;
        len--;
    }
    to = from + len;
    while (len > 0 && ossl_isspace(to[-1])) {
        to--;
        len--;
    }
    to = out->data;
    i = 0;
    while (i < len) {
        if (!ossl_isascii(*from)) {
            *to++ = *from++;
            i++;
        }
        else if (ossl_isspace(*from)) {
            *to++ = ' ';
            do {
                from++;
                i++;
            }
            while (ossl_isspace(*from));
        } else {
            *to++ = ossl_tolower(*from);
            from++;
            i++;
        }
    }
    out->length = to - out->data;
    return 1;
}
["static int asn1_string_canon(ASN1_STRING *out, const ASN1_STRING *in)\n{\n    unsigned char *to, *from;\n    int len, i;\n    if (!(ASN1_tag2bit(in->type) & ASN1_MASK_CANON)) {\n        if (!ASN1_STRING_copy(out, in))\n            return 0;\n        return 1;\n    }\n    out->type = V_ASN1_UTF8STRING;\n    out->length = ASN1_STRING_to_UTF8(&out->data, in);\n    if (out->length == -1)\n        return 0;\n    to = out->data;\n    from = to;\n    len = out->length;\n    while (len > 0 && ossl_isspace(*from)) {\n        from++;\n        len--;\n    }\n    to = from + len;\n    while (len > 0 && ossl_isspace(to[-1])) {\n        to--;\n        len--;\n    }\n    to = out->data;\n    i = 0;\n    while (i < len) {\n        if (!ossl_isascii(*from)) {\n            *to++ = *from++;\n            i++;\n        }\n        else if (ossl_isspace(*from)) {\n            *to++ = ' ';\n            do {\n                from++;\n                i++;\n            }\n            while (ossl_isspace(*from));\n        } else {\n            *to++ = ossl_tolower(*from);\n            from++;\n            i++;\n        }\n    }\n    out->length = to - out->data;\n    return 1;\n}", 'int ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in)\n{\n    ASN1_STRING stmp, *str = &stmp;\n    int mbflag, type, ret;\n    if (!in)\n        return -1;\n    type = in->type;\n    if ((type < 0) || (type > 30))\n        return -1;\n    mbflag = tag2nbyte[type];\n    if (mbflag == -1)\n        return -1;\n    mbflag |= MBSTRING_FLAG;\n    stmp.data = NULL;\n    stmp.length = 0;\n    stmp.flags = 0;\n    ret =\n        ASN1_mbstring_copy(&str, in->data, in->length, mbflag,\n                           B_ASN1_UTF8STRING);\n    if (ret < 0)\n        return ret;\n    *out = stmp.data;\n    return stmp.length;\n}']