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

Commit6ee479a

Browse files
committed
Fix invalid array access in trgm_regexp.c.
Brown-paper-bag bug in08c0d6a: I missed one place that neededto guard against RAINBOW arc colors. Remarkably, nothing noticedthe invalid array access except buildfarm member thorntail.Thanks to Noah Misch for assistance with tracking this down.
1 parentea1268f commit6ee479a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎contrib/pg_trgm/trgm_regexp.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,16 +1220,22 @@ addArcs(TrgmNFA *trgmNFA, TrgmState *state)
12201220
for (i=0;i<arcsCount;i++)
12211221
{
12221222
regex_arc_t*arc=&arcs[i];
1223-
TrgmColorInfo*colorInfo=&trgmNFA->colorInfo[arc->co];
1223+
TrgmColorInfo*colorInfo;
12241224

12251225
/*
12261226
* Ignore non-expandable colors; addKey already handled the case.
12271227
*
12281228
* We need no special check for WHITE or begin/end pseudocolors
12291229
* here. We don't need to do any processing for them, and they
12301230
* will be marked non-expandable since the regex engine will have
1231-
* reported them that way.
1231+
* reported them that way. We do have to watch out for RAINBOW,
1232+
* which has a negative color number.
12321233
*/
1234+
if (arc->co<0)
1235+
continue;
1236+
Assert(arc->co<trgmNFA->ncolors);
1237+
1238+
colorInfo=&trgmNFA->colorInfo[arc->co];
12331239
if (!colorInfo->expandable)
12341240
continue;
12351241

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp