BUG #18787: pointer te->defn not checked for NULL
BUG #18787: pointer te->defn not checked for NULL
От:
PG Bug reporting form <noreply@postgresql.org>
Дата:
The following bug has been logged on the website:
Bug reference: 18787
Logged by: Daniel Elishakov
Email address: dan-eli@mail.ru
PostgreSQL version: 16.6
Operating system: ubuntu 20.04
Description:
Here is a patch fixing the issue. I think that NULL check is needed here
diff --git a/src/bin/pg_dump/pg_backup_archiver.c
b/src/bin/pg_dump/pg_backup_archiver.c
index 958f88d420..ebb7eca43c 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -3654,7 +3654,7 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool
isData)
if (!ropt->noOwner &&
(!ropt->use_setsessauth ||
(strcmp(te->desc, "SCHEMA") == 0 &&
- strncmp(te->defn, "--", 2) == 0)) &&
+ (te->defn && strncmp(te->defn, "--", 2) == 0))) &&
te->owner && strlen(te->owner) > 0 &&
te->dropStmt && strlen(te->dropStmt) > 0)
{
Re: BUG #18787: pointer te->defn not checked for NULL
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
PG Bug reporting form writes: > Here is a patch fixing the issue. I think that NULL check is needed here In none of these three bug reports have you given an actual bug report --- that is, there is no reason to believe that these patches fix any reachable failure case. If you have examples showing that the cases are reachable, please provide those first, and then we can discuss suitable fixes. regards, tom lane