pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

honggfuzz: Make execvp(3) call more portable



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Sun Aug 5 00:25:36 2018 +0200
Changeset:	bf396e1952a05094e894088a89d00d9c2be8c6cf

Modified Files:
	honggfuzz/distinfo
Added Files:
	honggfuzz/patches/patch-hfuzz__cc_hfuzz-cc.c

Log Message:
honggfuzz: Make execvp(3) call more portable

argv[0] shall be the executed program, not something crafted.

This fixes the clang usage, it reads argv[0] to detect its name
and "c++" causes to call GCC.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=bf396e1952a05094e894088a89d00d9c2be8c6cf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 honggfuzz/distinfo                           |  1 +
 honggfuzz/patches/patch-hfuzz__cc_hfuzz-cc.c | 97 ++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+)

diffs:
diff --git a/honggfuzz/distinfo b/honggfuzz/distinfo
index 15f3b6bac9..a2c37dd9e9 100644
--- a/honggfuzz/distinfo
+++ b/honggfuzz/distinfo
@@ -5,5 +5,6 @@ RMD160 (honggfuzz-1.6.tar.gz) = 8ef15a0e38cd09a26f82a3683da6a363257ddce1
 SHA512 (honggfuzz-1.6.tar.gz) = db4f0f31d36080db983068435be82b3e1132145e0bad5c4e8e6504563f10ce66df4f977fbd0a9f1cbcd262e479f635a68ab7c1df70d23e8437164734ea562c90
 Size (honggfuzz-1.6.tar.gz) = 79322453 bytes
 SHA1 (patch-Makefile) = 3c0242922d4e457637072ef93cd1a7cb5cf8973f
+SHA1 (patch-hfuzz__cc_hfuzz-cc.c) = bec125d8545a3221045c7cd9b8c02225767141e7
 SHA1 (patch-libhfcommon_util.c) = 9f00448a2cfc3436c87a2b2a33dcd92de6afc49b
 SHA1 (patch-libhfuzz_memorycmp.c) = fed71b1e414f54788cabec18f4cd7fda40585123
diff --git a/honggfuzz/patches/patch-hfuzz__cc_hfuzz-cc.c b/honggfuzz/patches/patch-hfuzz__cc_hfuzz-cc.c
new file mode 100644
index 0000000000..ee6c20c1b3
--- /dev/null
+++ b/honggfuzz/patches/patch-hfuzz__cc_hfuzz-cc.c
@@ -0,0 +1,97 @@
+$NetBSD$
+
+--- hfuzz_cc/hfuzz-cc.c.orig	2018-04-19 13:37:38.000000000 +0000
++++ hfuzz_cc/hfuzz-cc.c
+@@ -102,6 +102,13 @@ static bool isLDMode(int argc, char** ar
+     return true;
+ }
+ 
++static int
++hf_execvp(const char *file, char *const argv[])
++{
++	argv[0] = file;
++	execvp(file, argv);
++}
++
+ static int execCC(int argc, char** argv) {
+     if (useASAN()) {
+         argv[argc++] = "-fsanitize=address";
+@@ -117,14 +124,14 @@ static int execCC(int argc, char** argv)
+     if (isCXX) {
+         const char* cxx_path = getenv("HFUZZ_CXX_PATH");
+         if (cxx_path != NULL) {
+-            execvp(cxx_path, argv);
++            hf_execvp(cxx_path, argv);
+             PLOG_E("execvp('%s')", cxx_path);
+             return EXIT_FAILURE;
+         }
+     } else {
+         const char* cc_path = getenv("HFUZZ_CC_PATH");
+         if (cc_path != NULL) {
+-            execvp(cc_path, argv);
++            hf_execvp(cc_path, argv);
+             PLOG_E("execvp('%s')", cc_path);
+             return EXIT_FAILURE;
+         }
+@@ -132,37 +139,37 @@ static int execCC(int argc, char** argv)
+ 
+     if (isGCC) {
+         if (isCXX) {
+-            execvp("g++", argv);
+-            execvp("gcc", argv);
++            hf_execvp("g++", argv);
++            hf_execvp("gcc", argv);
+         } else {
+-            execvp("gcc", argv);
++            hf_execvp("gcc", argv);
+         }
+     } else {
+         if (isCXX) {
+             /* Try the default one, then newest ones (hopefully) first */
+-            execvp("clang++", argv);
+-            execvp("clang++-devel", argv);
+-            execvp("clang++-10.0", argv);
+-            execvp("clang++-9.0", argv);
+-            execvp("clang++-8.0", argv);
+-            execvp("clang++-7.0", argv);
+-            execvp("clang++-7", argv);
+-            execvp("clang++-6.0", argv);
+-            execvp("clang++-5.0", argv);
+-            execvp("clang++-4.0", argv);
+-            execvp("clang", argv);
++            hf_execvp("clang++", argv);
++            hf_execvp("clang++-devel", argv);
++            hf_execvp("clang++-10.0", argv);
++            hf_execvp("clang++-9.0", argv);
++            hf_execvp("clang++-8.0", argv);
++            hf_execvp("clang++-7.0", argv);
++            hf_execvp("clang++-7", argv);
++            hf_execvp("clang++-6.0", argv);
++            hf_execvp("clang++-5.0", argv);
++            hf_execvp("clang++-4.0", argv);
++            hf_execvp("clang", argv);
+         } else {
+             /* Try the default one, then newest ones (hopefully) first */
+-            execvp("clang", argv);
+-            execvp("clang-devel", argv);
+-            execvp("clang-10.0", argv);
+-            execvp("clang-9.0", argv);
+-            execvp("clang-8.0", argv);
+-            execvp("clang-7.0", argv);
+-            execvp("clang-7", argv);
+-            execvp("clang-6.0", argv);
+-            execvp("clang-5.0", argv);
+-            execvp("clang-4.0", argv);
++            hf_execvp("clang", argv);
++            hf_execvp("clang-devel", argv);
++            hf_execvp("clang-10.0", argv);
++            hf_execvp("clang-9.0", argv);
++            hf_execvp("clang-8.0", argv);
++            hf_execvp("clang-7.0", argv);
++            hf_execvp("clang-7", argv);
++            hf_execvp("clang-6.0", argv);
++            hf_execvp("clang-5.0", argv);
++            hf_execvp("clang-4.0", argv);
+         }
+     }
+ 


Home | Main Index | Thread Index | Old Index