mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
pg_dump: Fix crash with invalid pg_cast row
An invalid combination of pg_cast.castfunc and pg_cast.castmethod would result in a segmentation fault. Now it prints a warning. found by Coverity
This commit is contained in:
parent
d8e5b3427a
commit
359dea2859
@ -9477,6 +9477,7 @@ dumpCast(Archive *fout, CastInfo *cast)
|
|||||||
appendPQExpBuffer(defqry, "WITH INOUT");
|
appendPQExpBuffer(defqry, "WITH INOUT");
|
||||||
break;
|
break;
|
||||||
case COERCION_METHOD_FUNCTION:
|
case COERCION_METHOD_FUNCTION:
|
||||||
|
if (funcInfo)
|
||||||
{
|
{
|
||||||
char *fsig = format_function_signature(fout, funcInfo, true);
|
char *fsig = format_function_signature(fout, funcInfo, true);
|
||||||
|
|
||||||
@ -9487,8 +9488,10 @@ dumpCast(Archive *fout, CastInfo *cast)
|
|||||||
appendPQExpBuffer(defqry, "WITH FUNCTION %s.%s",
|
appendPQExpBuffer(defqry, "WITH FUNCTION %s.%s",
|
||||||
fmtId(funcInfo->dobj.namespace->dobj.name), fsig);
|
fmtId(funcInfo->dobj.namespace->dobj.name), fsig);
|
||||||
free(fsig);
|
free(fsig);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
write_msg(NULL, "WARNING: bogus value in pg_cast.castfunc or pg_cast.castmethod field\n");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
write_msg(NULL, "WARNING: bogus value in pg_cast.castmethod field\n");
|
write_msg(NULL, "WARNING: bogus value in pg_cast.castmethod field\n");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user