]> granicus.if.org Git - postgresql/commitdiff
Fix possible use of uninitialised value in ts_headline()
authorTeodor Sigaev <teodor@sigaev.ru>
Fri, 8 Apr 2016 18:25:32 +0000 (21:25 +0300)
committerTeodor Sigaev <teodor@sigaev.ru>
Fri, 8 Apr 2016 18:25:32 +0000 (21:25 +0300)
Found during investigation of failure of skink buildfarm member and its
valgrind report.

Backpatch to all supported branches

src/backend/tsearch/wparser_def.c

index 18ff9e2961c882b8d509a60ba05c8c09c89908cd..c03b7271206f2dd0975449a937a4049d92d10eac 100644 (file)
@@ -2441,6 +2441,8 @@ mark_hl_words(HeadlineParsedText *prs, TSQuery query, int highlight,
                        }
                        else
                        {                                       /* shorter cover :((( */
+                               if (i > q)
+                                       i = q;
                                for (; curlen > min_words; i--)
                                {
                                        if (!NONWORDTOKEN(prs->words[i].type))