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

Commitd74ecbc

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 parentc52d37c commitd74ecbc

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
@@ -5643,6 +5643,9 @@ getOwnedSeqs(Archive *fout, TableInfo tblinfo[], int numTables)
56435643
continue;/* not an owned sequence */
56445644

56455645
owning_tab = findTableByOid(seqinfo->owning_tab);
5646+
if (owning_tab == NULL)
5647+
exit_horribly(NULL, "failed sanity check, parent table OID %u of sequence OID %u not found\n",
5648+
seqinfo->owning_tab, seqinfo->dobj.catId.oid);
56465649

56475650
/*
56485651
* We need to dump the components that are being dumped for the table
@@ -15583,7 +15586,11 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
1558315586
{
1558415587
TableInfo *owning_tab = findTableByOid(tbinfo->owning_tab);
1558515588

15586-
if (owning_tab && owning_tab->dobj.dump & DUMP_COMPONENT_DEFINITION)
15589+
if (owning_tab == NULL)
15590+
exit_horribly(NULL, "failed sanity check, parent table OID %u of sequence OID %u not found\n",
15591+
tbinfo->owning_tab, tbinfo->dobj.catId.oid);
15592+
15593+
if (owning_tab->dobj.dump & DUMP_COMPONENT_DEFINITION)
1558715594
{
1558815595
resetPQExpBuffer(query);
1558915596
appendPQExpBuffer(query, "ALTER SEQUENCE %s",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp