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

Commitfebda37

Browse files
committed
Avoid platform-dependent infinite loop in pg_dump.
If malloc(0) returns NULL, the binary search in findSecLabels() willprobably go into an infinite loop when there are no security labels,because NULL-1 is greater than NULL after wraparound.(We've seen this pathology before ... I wonder whether there's a way todetect the class of bugs automatically?)Diagnosis and patch by Steve Singer, cosmetic adjustments by me
1 parent37e66e7 commitfebda37

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,9 +643,10 @@ main(int argc, char **argv)
643643
do_sql_command(g_conn,"SET quote_all_identifiers = true");
644644

645645
/*
646-
* Disables security label support if server version < v9.1.x
646+
* Disable security label support if server version < v9.1.x (prevents
647+
* access to nonexistent pg_seclabel catalog)
647648
*/
648-
if (!no_security_labels&&g_fout->remoteVersion<90100)
649+
if (g_fout->remoteVersion<90100)
649650
no_security_labels=1;
650651

651652
/*
@@ -11761,6 +11762,12 @@ findSecLabels(Archive *fout, Oid classoid, Oid objoid, SecLabelItem **items)
1176111762
if (nlabels<0)
1176211763
nlabels=collectSecLabels(fout,&labels);
1176311764

11765+
if (nlabels <=0)/* no labels, so no match is possible */
11766+
{
11767+
*items=NULL;
11768+
return0;
11769+
}
11770+
1176411771
/*
1176511772
* Do binary search to find some item matching the object.
1176611773
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp