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

Commit359dea2

Browse files
committed
pg_dump: Fix crash with invalid pg_cast row
An invalid combination of pg_cast.castfunc and pg_cast.castmethodwould result in a segmentation fault. Now it prints a warning.found by Coverity
1 parentd8e5b34 commit359dea2

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9477,18 +9477,21 @@ dumpCast(Archive *fout, CastInfo *cast)
94779477
appendPQExpBuffer(defqry,"WITH INOUT");
94789478
break;
94799479
caseCOERCION_METHOD_FUNCTION:
9480-
{
9481-
char*fsig=format_function_signature(fout,funcInfo, true);
9480+
if (funcInfo)
9481+
{
9482+
char*fsig=format_function_signature(fout,funcInfo, true);
94829483

9483-
/*
9484-
* Always qualify the function name, in case it is not in
9485-
* pg_catalog schema (format_function_signature won't qualify it).
9486-
*/
9487-
appendPQExpBuffer(defqry,"WITH FUNCTION %s.%s",
9488-
fmtId(funcInfo->dobj.namespace->dobj.name),fsig);
9489-
free(fsig);
9484+
/*
9485+
* Always qualify the function name, in case it is not in
9486+
* pg_catalog schema (format_function_signature won't qualify it).
9487+
*/
9488+
appendPQExpBuffer(defqry,"WITH FUNCTION %s.%s",
9489+
fmtId(funcInfo->dobj.namespace->dobj.name),fsig);
9490+
free(fsig);
9491+
}
9492+
else
9493+
write_msg(NULL,"WARNING: bogus value in pg_cast.castfunc or pg_cast.castmethod field\n");
94909494
break;
9491-
}
94929495
default:
94939496
write_msg(NULL,"WARNING: bogus value in pg_cast.castmethod field\n");
94949497
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp