postgresql: fix build (#5618)

* postgresql: fix patch.

* enable afl

* Fix afl build.

* Fix build.sh.
This commit is contained in:
DavidKorczynski 2021-04-15 12:48:02 +01:00 committed by GitHub
parent 53a97ef111
commit 30f3a8f1c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 12 deletions

View File

@ -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

View File

@ -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/

View File

@ -9,5 +9,6 @@ auto_ccs:
fuzzing_engines:
- libfuzzer
- honggfuzz
- afl
sanitizers:
- address