test/evp_test.c:2089: error: BUFFER_OVERRUN_L3
  Offset: [-1, +oo] Size: 10240 by call to `parse_test_line`.
Showing all 8 steps of the trace


test/evp_test.c:2074:1: Array declaration
2072.   };
2073.   
2074. > static int do_test_file(const char *testfile)
2075.   {
2076.       BIO *in;

test/evp_test.c:2089:14: Call
2087.       while (BIO_gets(in, buf, sizeof(buf))) {
2088.           t.line++;
2089.           if (!TEST_true(parse_test_line(&t, buf)))
                     ^
2090.               return 0;
2091.       }

test/evp_test.c:504:1: Parameter `*buf`
  502.    * Parse a line into the current test |t|.  Return 0 on error.
  503.    */
  504. > static int parse_test_line(EVP_TEST *t, char *buf)
  505.   {
  506.       char *keyword = NULL, *value = NULL;

test/evp_test.c:512:10: Call
  510.       const EVP_TEST_METHOD *tmeth = NULL;
  511.   
  512.       if (!parse_line(&keyword, &value, buf))
                  ^
  513.           return 1;
  514.       if (strcmp(keyword, "PrivateKey") == 0) {

test/evp_test.c:49:1: <Length trace>
47.    * extract name and value. NB: modifies |linebuf|.
48.    */
49. > static int parse_line(char **pkw, char **pval, char *linebuf)
50.   {
51.       char *p = linebuf + strlen(linebuf) - 1;

test/evp_test.c:49:1: Parameter `*linebuf`
    47.    * extract name and value. NB: modifies |linebuf|.
    48.    */
    49. > static int parse_line(char **pkw, char **pval, char *linebuf)
    50.   {
    51.       char *p = linebuf + strlen(linebuf) - 1;

test/evp_test.c:51:5: Assignment
    49.   static int parse_line(char **pkw, char **pval, char *linebuf)
    50.   {
    51.       char *p = linebuf + strlen(linebuf) - 1;
              ^
    52.   
    53.       if (*p != '\n') {

test/evp_test.c:53:9: Array access: Offset: [-1, +oo] Size: 10240 by call to `parse_test_line` 
    51.       char *p = linebuf + strlen(linebuf) - 1;
    52.   
    53.       if (*p != '\n') {
                  ^
    54.           TEST_error("FATAL: missing EOL");
    55.           return 0;

static int parse_line(char **pkw, char **pval, char *linebuf)
{
    char *p = linebuf + strlen(linebuf) - 1;
    if (*p != '\n') {
        TEST_error("FATAL: missing EOL");
        return 0;
    }
    p = strchr(linebuf, '#');
    if (p != NULL)
        *p = '\0';
    if ((p = strchr(linebuf, '=')) == NULL)
        return 0;
    *p++ = '\0';
    *pkw = linebuf;
    *pval = p;
    remove_space(pkw);
    remove_space(pval);
    return 1;
}
['static int do_test_file(const char *testfile)\n{\n    BIO *in;\n    char buf[10240];\n    EVP_TEST t;\n    current_test_file = testfile;\n    if (!TEST_ptr(in = BIO_new_file(testfile, "rb")))\n        return 0;\n    memset(&t, 0, sizeof(t));\n    t.start_line = -1;\n    t.in = in;\n    t.err = NULL;\n    while (BIO_gets(in, buf, sizeof(buf))) {\n        t.line++;\n        if (!TEST_true(parse_test_line(&t, buf)))\n            return 0;\n    }\n    if (!run_and_get_next(&t, NULL))\n        return 0;\n    TEST_info("Completed %d tests with %d errors and %d skipped",\n              t.ntests, t.errors, t.nskip);\n    free_key_list(public_keys);\n    free_key_list(private_keys);\n    BIO_free(t.key);\n    BIO_free(in);\n    return t.errors == 0;\n}', 'static int parse_test_line(EVP_TEST *t, char *buf)\n{\n    char *keyword = NULL, *value = NULL;\n    int add_key = 0;\n    KEY_LIST **lst = NULL, *key = NULL;\n    EVP_PKEY *pk = NULL;\n    const EVP_TEST_METHOD *tmeth = NULL;\n    if (!parse_line(&keyword, &value, buf))\n        return 1;\n    if (strcmp(keyword, "PrivateKey") == 0) {\n        if (!read_key(t))\n            return 0;\n        pk = PEM_read_bio_PrivateKey(t->key, NULL, 0, NULL);\n        if (pk == NULL && !check_unsupported()) {\n            TEST_info("Error reading private key %s", value);\n            ERR_print_errors_fp(stderr);\n            return 0;\n        }\n        lst = &private_keys;\n        add_key = 1;\n    }\n    if (strcmp(keyword, "PublicKey") == 0) {\n        if (!read_key(t))\n            return 0;\n        pk = PEM_read_bio_PUBKEY(t->key, NULL, 0, NULL);\n        if (pk == NULL && !check_unsupported()) {\n            TEST_info("Error reading public key %s", value);\n            ERR_print_errors_fp(stderr);\n            return 0;\n        }\n        lst = &public_keys;\n        add_key = 1;\n    }\n    if (add_key) {\n        if (find_key(NULL, value, *lst)) {\n            TEST_info("Duplicate key %s", value);\n            return 0;\n        }\n        if (!TEST_ptr(key = OPENSSL_malloc(sizeof(*key)))\n                || !TEST_ptr(key->name = OPENSSL_strdup(value)))\n            return 0;\n        key->key = pk;\n        key->next = *lst;\n        *lst = key;\n        return 1;\n    }\n    if ((tmeth = evp_find_test(keyword)) != NULL) {\n        if (!run_and_get_next(t, tmeth))\n            return 0;\n        t->start_line = t->line;\n        t->skip = 0;\n        if (!tmeth->init(t, value)) {\n            TEST_info("Unknown %s: %s", keyword, value);\n            return 0;\n        }\n        return 1;\n    }\n    if (t->skip)\n        return 1;\n    if (strcmp(keyword, "Result") == 0) {\n        if (t->expected_err) {\n            TEST_info("Line %d: multiple result lines", t->line);\n            return 0;\n        }\n        if (!TEST_ptr(t->expected_err = OPENSSL_strdup(value)))\n            return 0;\n    } else if (strcmp(keyword, "Function") == 0) {\n        if (t->func != NULL) {\n            TEST_info("Line %d: multiple function lines\\n", t->line);\n            return 0;\n        }\n        if (!TEST_ptr(t->func = OPENSSL_strdup(value)))\n            return 0;\n    } else if (strcmp(keyword, "Reason") == 0) {\n        if (t->reason != NULL) {\n            TEST_info("Line %d: multiple reason lines", t->line);\n            return 0;\n        }\n        if (!TEST_ptr(t->reason = OPENSSL_strdup(value)))\n            return 0;\n    } else {\n        int rv = t->meth == NULL ? 0 : t->meth->parse(t, keyword, value);\n        if (rv == 0) {\n            TEST_info("Line %d: unknown keyword %s", t->line, keyword);\n            return 0;\n        }\n        if (rv < 0) {\n            TEST_info("Line %d: error processing keyword %s\\n",\n                      t->line, keyword);\n            return 0;\n        }\n    }\n    return 1;\n}', 'static int parse_line(char **pkw, char **pval, char *linebuf)\n{\n    char *p = linebuf + strlen(linebuf) - 1;\n    if (*p != \'\\n\') {\n        TEST_error("FATAL: missing EOL");\n        return 0;\n    }\n    p = strchr(linebuf, \'#\');\n    if (p != NULL)\n        *p = \'\\0\';\n    if ((p = strchr(linebuf, \'=\')) == NULL)\n        return 0;\n    *p++ = \'\\0\';\n    *pkw = linebuf;\n    *pval = p;\n    remove_space(pkw);\n    remove_space(pval);\n    return 1;\n}']