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

Commit80a96e0

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 parent1c5d927 commit80a96e0

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
@@ -1308,7 +1308,6 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
13081308
for (keyno=0;keyno<idxrec->indnatts;keyno++)
13091309
{
13101310
AttrNumberattnum=idxrec->indkey.values[keyno];
1311-
int16opt=indoption->values[keyno];
13121311
Oidkeycoltype;
13131312
Oidkeycolcollation;
13141313

@@ -1370,10 +1369,10 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
13701369
if (!attrsOnly&&keyno<idxrec->indnkeyatts&&
13711370
(!colno||colno==keyno+1))
13721371
{
1373-
Oidindcoll;
1372+
int16opt=indoption->values[keyno];
1373+
Oidindcoll=indcollation->values[keyno];
13741374

13751375
/* Add collation, if not default for column */
1376-
indcoll=indcollation->values[keyno];
13771376
if (OidIsValid(indcoll)&&indcoll!=keycolcollation)
13781377
appendStringInfo(&buf," COLLATE %s",
13791378
generate_collation_name((indcoll)));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp