aboutsummaryrefslogtreecommitdiffhomepage
path: root/projects/postgresql
diff options
context:
space:
mode:
authorGravatar DavidKorczynski <david@adalogics.com>2021-04-15 12:48:02 +0100
committerGravatar GitHub <noreply@github.com>2021-04-15 12:48:02 +0100
commit30f3a8f1c0f5b072e77d5bea82709db04c53453d (patch)
tree216e31ccd853725e02eb667383f4b3ac11ad3578 /projects/postgresql
parent53a97ef11138f4bdc8c05c95adbc2913cda92126 (diff)
postgresql: fix build (#5618)
* postgresql: fix patch. * enable afl * Fix afl build. * Fix build.sh.
Diffstat (limited to 'projects/postgresql')
-rw-r--r--projects/postgresql/add_fuzzers.diff25
-rw-r--r--projects/postgresql/build.sh4
-rw-r--r--projects/postgresql/project.yaml1
3 files changed, 18 insertions, 12 deletions
diff --git a/projects/postgresql/add_fuzzers.diff b/projects/postgresql/add_fuzzers.diff
index 86b106c2..b7a47942 100644
--- a/projects/postgresql/add_fuzzers.diff
+++ b/projects/postgresql/add_fuzzers.diff
@@ -1,18 +1,19 @@
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
-index cb5a96117f..c9b4880085 100644
+index 825fd55107..f3e2dbbf20 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
-@@ -102,6 +102,9 @@ int max_stack_depth = 100;
- /* wait N seconds to allow attach from a debugger */
- int PostAuthDelay = 0;
+@@ -105,6 +105,10 @@ int PostAuthDelay = 0;
+ /* Time between checks that the client is still connected. */
+ int client_connection_check_interval = 0;
+#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
+bool fuzzer_first_run = true;
+#endif
-
-
++
/* ----------------
-@@ -507,10 +510,15 @@ ReadCommand(StringInfo inBuf)
+ * private typedefs etc
+ * ----------------
+@@ -454,10 +458,15 @@ ReadCommand(StringInfo inBuf)
{
int result;
@@ -28,7 +29,7 @@ index cb5a96117f..c9b4880085 100644
return result;
}
-@@ -3846,6 +3854,11 @@ PostgresMain(int argc, char *argv[],
+@@ -3910,6 +3919,11 @@ PostgresMain(int argc, char *argv[],
bool idle_in_transaction_timeout_enabled = false;
bool idle_session_timeout_enabled = false;
@@ -40,7 +41,7 @@ index cb5a96117f..c9b4880085 100644
/* Initialize startup process environment if necessary. */
if (!IsUnderPostmaster)
InitStandaloneProcess(argv[0]);
-@@ -4207,6 +4220,11 @@ PostgresMain(int argc, char *argv[],
+@@ -4271,6 +4285,11 @@ PostgresMain(int argc, char *argv[],
if (!ignore_till_sync)
send_ready_for_query = true; /* initially, or after error */
@@ -53,11 +54,11 @@ index cb5a96117f..c9b4880085 100644
* Non-error queries loop here.
*/
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
-index 80c2672461..c16e0423c5 100644
+index a1ebe06d5b..dfa94013a0 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
-@@ -600,7 +600,9 @@ errfinish(const char *filename, int lineno, const char *funcname)
- pq_endcopyout(true);
+@@ -594,7 +594,9 @@ errfinish(const char *filename, int lineno, const char *funcname)
+ }
/* Emit the message to the right places */
+#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
diff --git a/projects/postgresql/build.sh b/projects/postgresql/build.sh
index 12fb754a..4e001ad0 100644
--- a/projects/postgresql/build.sh
+++ b/projects/postgresql/build.sh
@@ -35,5 +35,9 @@ make clean
make
cd src/backend/fuzzer
make fuzzer
+if [ "$FUZZING_ENGINE" = "afl" ]
+then
+ rm protocol_fuzzer
+fi
cp *_fuzzer $OUT/
cp $SRC/postgresql_fuzzer_seed_corpus.zip $OUT/
diff --git a/projects/postgresql/project.yaml b/projects/postgresql/project.yaml
index 9057d989..5cc7a3ff 100644
--- a/projects/postgresql/project.yaml
+++ b/projects/postgresql/project.yaml
@@ -9,5 +9,6 @@ auto_ccs:
fuzzing_engines:
- libfuzzer
- honggfuzz
+ - afl
sanitizers:
- address