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

Commita7ca25c

Browse files
committed
Avoid fetching past the end of the indoption array.
pg_get_indexdef_worker carelessly fetched indoption entries even fornon-key index columns that don't have one. 99.999% of the time thiswould be harmless, since the code wouldn't examine the value ... butsome fine day this will be a fetch off the end of memory, resultingin SIGSEGV.Detected through valgrind testing. Odd that the buildfarm's valgrindcritters haven't noticed.
1 parent10e3991 commita7ca25c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

‎src/backend/utils/adt/ruleutils.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,6 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
13051305
for (keyno=0;keyno<idxrec->indnatts;keyno++)
13061306
{
13071307
AttrNumberattnum=idxrec->indkey.values[keyno];
1308-
int16opt=indoption->values[keyno];
13091308
Oidkeycoltype;
13101309
Oidkeycolcollation;
13111310

@@ -1367,10 +1366,10 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
13671366
if (!attrsOnly&&keyno<idxrec->indnkeyatts&&
13681367
(!colno||colno==keyno+1))
13691368
{
1370-
Oidindcoll;
1369+
int16opt=indoption->values[keyno];
1370+
Oidindcoll=indcollation->values[keyno];
13711371

13721372
/* Add collation, if not default for column */
1373-
indcoll=indcollation->values[keyno];
13741373
if (OidIsValid(indcoll)&&indcoll!=keycolcollation)
13751374
appendStringInfo(&buf," COLLATE %s",
13761375
generate_collation_name((indcoll)));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp