Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8b1bf31

Browse files
committed
Protect against NULL-dereference in pg_dump
findTableByOid() is allowed to return NULL and we should therefore bechecking for that case. getOwnedSeqs() and dumpSequence() shouldn'tever actually see this happen, but given odd circumstances it might andcommitf9e439b probably shouldn't have removed that check.Pointed out by Coverity. Initial patch from Michael Paquier.Back-patch to 9.6, where that commit had removed the check.
1 parent4103a2f commit8b1bf31

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6089,6 +6089,9 @@ getOwnedSeqs(Archive *fout, TableInfo tblinfo[], int numTables)
60896089
continue;/* not an owned sequence */
60906090

60916091
owning_tab = findTableByOid(seqinfo->owning_tab);
6092+
if (owning_tab == NULL)
6093+
exit_horribly(NULL, "failed sanity check, parent table OID %u of sequence OID %u not found\n",
6094+
seqinfo->owning_tab, seqinfo->dobj.catId.oid);
60926095

60936096
/*
60946097
* We need to dump the components that are being dumped for the table
@@ -16537,7 +16540,11 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
1653716540
{
1653816541
TableInfo *owning_tab = findTableByOid(tbinfo->owning_tab);
1653916542

16540-
if (owning_tab && owning_tab->dobj.dump & DUMP_COMPONENT_DEFINITION)
16543+
if (owning_tab == NULL)
16544+
exit_horribly(NULL, "failed sanity check, parent table OID %u of sequence OID %u not found\n",
16545+
tbinfo->owning_tab, tbinfo->dobj.catId.oid);
16546+
16547+
if (owning_tab->dobj.dump & DUMP_COMPONENT_DEFINITION)
1654116548
{
1654216549
resetPQExpBuffer(query);
1654316550
appendPQExpBuffer(query, "ALTER SEQUENCE %s",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp