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

Commitcf22e85

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 parent409b8c7 commitcf22e85

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
@@ -645,9 +645,10 @@ main(int argc, char **argv)
645645
do_sql_command(g_conn,"SET quote_all_identifiers = true");
646646

647647
/*
648-
* Disables security label support if server version < v9.1.x
648+
* Disable security label support if server version < v9.1.x (prevents
649+
* access to nonexistent pg_seclabel catalog)
649650
*/
650-
if (!no_security_labels&&g_fout->remoteVersion<90100)
651+
if (g_fout->remoteVersion<90100)
651652
no_security_labels=1;
652653

653654
/*
@@ -11993,6 +11994,12 @@ findSecLabels(Archive *fout, Oid classoid, Oid objoid, SecLabelItem **items)
1199311994
if (nlabels<0)
1199411995
nlabels=collectSecLabels(fout,&labels);
1199511996

11997+
if (nlabels <=0)/* no labels, so no match is possible */
11998+
{
11999+
*items=NULL;
12000+
return0;
12001+
}
12002+
1199612003
/*
1199712004
* Do binary search to find some item matching the object.
1199812005
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp