{"schema":"libjg2-1",
"vpath":"/git/",
"avatar":"/git/avatar/",
"alang":"",
"gen_ut":1752656893,
"reponame":"openssl",
"desc":"OpenSSL",
"owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://warmcat.com/repo/openssl",
"f":3,
"items": [
{"schema":"libjg2-1",
"cid":"27ea1b30f6efca2dfaf42f1e42876b9e",
"commit": {"type":"commit",
"time": 1522308296,
"time_ofs": 120,
"oid_tree": { "oid": "eb27afd1dfab10f4d4114c14acde9c88d106fffa", "alias": []},
"oid":{ "oid": "9d740909595546ebd34a845e6328cb60afa388b8", "alias": []},
"msg": "Faster fuzz test: teach the fuzz test programs to handle directories",
"sig_commit": { "git_time": { "time": 1522308296, "offset": 120 }, "name": "Richard Levitte", "email": "levitte@openssl.org", "md5": "b737120f0642a6a5c30c6291e6170c77" },
"sig_author": { "git_time": { "time": 1522244788, "offset": 120 }, "name": "Richard Levitte", "email": "levitte@openssl.org", "md5": "b737120f0642a6a5c30c6291e6170c77" }},
"body": "Faster fuzz test: teach the fuzz test programs to handle directories\n\nInstead of invoking the fuzz test programs once for every corpora\nfile, we invoke them once for each directory of corpora files. This\ndramatically reduces the number of program invikations, as well as the\ntime 99-test_fuzz.t takes to complete.\n\nfuzz/test-corpus.c was enhanced to handle directories as well as\nregular files.\n\nReviewed-by: Bernd Edlinger \u003cbernd.edlinger@hotmail.de\u003e\nReviewed-by: Rich Salz \u003crsalz@openssl.org\u003e\n(Merged from https://github.com/openssl/openssl/pull/5776)\n"
,
"diff": "diff --git a/fuzz/test-corpus.c b/fuzz/test-corpus.c\nindex 9cef01f..95ffcf2 100644\n--- a/fuzz/test-corpus.c\n+++ b/fuzz/test-corpus.c\n@@ -16,31 +16,86 @@\n \n #include \u003cstdio.h\u003e\n #include \u003cstdlib.h\u003e\n+#include \u003cstring.h\u003e\n #include \u003csys/stat.h\u003e\n #include \u003copenssl/crypto.h\u003e\n #include \u0022fuzzer.h\u0022\n+#include \u0022internal/o_dir.h\u0022\n \n-int main(int argc, char **argv) {\n- int n;\n+#if defined(_WIN32) \u0026\u0026 defined(_MAX_PATH)\n+# define PATH_MAX _MAX_PATH\n+#endif\n \n- FuzzerInitialize(\u0026argc, \u0026argv);\n+#ifndef PATH_MAX\n+# define PATH_MAX 4096\n+#endif\n \n- for (n \u003d 1; n \u003c argc; ++n) {\n- struct stat st;\n- FILE *f;\n- unsigned char *buf;\n- size_t s;\n-\n- stat(argv[n], \u0026st);\n- f \u003d fopen(argv[n], \u0022rb\u0022);\n- if (f \u003d\u003d NULL)\n- continue;\n- buf \u003d malloc(st.st_size);\n+# if !defined(S_ISREG)\n+# define S_ISREG(m) ((m) \u0026 S_IFREG)\n+# endif\n+\n+static void testfile(const char *pathname)\n+{\n+ struct stat st;\n+ FILE *f;\n+ unsigned char *buf;\n+ size_t s;\n+\n+ if (stat(pathname, \u0026st) \u003c 0 || !S_ISREG(st.st_mode))\n+ return;\n+ printf(\u0022# %s\u005cn\u0022, pathname);\n+ fflush(stdout);\n+ f \u003d fopen(pathname, \u0022rb\u0022);\n+ if (f \u003d\u003d NULL)\n+ return;\n+ buf \u003d malloc(st.st_size);\n+ if (buf !\u003d NULL) {\n s \u003d fread(buf, 1, st.st_size, f);\n OPENSSL_assert(s \u003d\u003d (size_t)st.st_size);\n FuzzerTestOneInput(buf, s);\n free(buf);\n- fclose(f);\n+ }\n+ fclose(f);\n+}\n+\n+int main(int argc, char **argv) {\n+ int n;\n+\n+ FuzzerInitialize(\u0026argc, \u0026argv);\n+\n+ for (n \u003d 1; n \u003c argc; ++n) {\n+ size_t dirname_len \u003d strlen(argv[n]);\n+ const char *filename \u003d NULL;\n+ char *pathname \u003d NULL;\n+ OPENSSL_DIR_CTX *ctx \u003d NULL;\n+ int wasdir \u003d 0;\n+\n+ /*\n+ * We start with trying to read the given path as a directory.\n+ */\n+ while ((filename \u003d OPENSSL_DIR_read(\u0026ctx, argv[n])) !\u003d NULL) {\n+ wasdir \u003d 1;\n+ if (pathname \u003d\u003d NULL) {\n+ pathname \u003d malloc(PATH_MAX);\n+ if (pathname \u003d\u003d NULL)\n+ break;\n+ strcpy(pathname, argv[n]);\n+#ifdef __VMS\n+ if (strchr(\u0022:\u003c]\u0022, pathname[dirname_len - 1]) \u003d\u003d NULL)\n+#endif\n+ pathname[dirname_len++] \u003d '/';\n+ pathname[dirname_len] \u003d '\u005c0';\n+ }\n+ strcpy(pathname + dirname_len, filename);\n+ testfile(pathname);\n+ }\n+ OPENSSL_DIR_end(\u0026ctx);\n+\n+ /* If it wasn't a directory, treat it as a file instead */\n+ if (!wasdir)\n+ testfile(argv[n]);\n+\n+ free(pathname);\n }\n \n FuzzerCleanup();\ndiff --git a/test/recipes/99-test_fuzz.t b/test/recipes/99-test_fuzz.t\nindex 9322ff7..2c45fec 100644\n--- a/test/recipes/99-test_fuzz.t\n+++ b/test/recipes/99-test_fuzz.t\n@@ -26,14 +26,14 @@ plan tests \u003d\u003e scalar @fuzzers;\n \n foreach my $f (@fuzzers) {\n subtest \u0022Fuzzing $f\u0022 \u003d\u003e sub {\n- my @files \u003d glob(srctop_file('fuzz', 'corpora', $f, '*'));\n- push @files, glob(srctop_file('fuzz', 'corpora', \u0022$f-*\u0022, '*'));\n+ my @dirs \u003d glob(srctop_file('fuzz', 'corpora', $f));\n+ push @dirs, glob(srctop_file('fuzz', 'corpora', \u0022$f-*\u0022));\n \n- plan skip_all \u003d\u003e \u0022No corpora for $f-test\u0022 unless @files;\n+ plan skip_all \u003d\u003e \u0022No corpora for $f-test\u0022 unless @dirs;\n \n- plan tests \u003d\u003e scalar @files;\n+ plan tests \u003d\u003e scalar @dirs;\n \n- foreach (@files) {\n+ foreach (@dirs) {\n ok(run(fuzz([\u0022$f-test\u0022, $_])));\n }\n }\n","s":{"c":1752656893,"u": 58741}}
],"g": 60083,"chitpc": 0,"ehitpc": 0,"indexed":0
,
"ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}