From: Teodor Sigaev Date: Fri, 8 Apr 2016 18:26:12 +0000 (+0300) Subject: Fix possible use of uninitialised value in ts_headline() X-Git-Tag: REL9_2_17~28 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=d1eee9ba85be978c5b137d657dc8e3fd7bc2cebd;p=postgresql.git Fix possible use of uninitialised value in ts_headline() Found during investigation of failure of skink buildfarm member and its valgrind report. Backpatch to all supported branches --- diff --git a/src/backend/tsearch/wparser_def.c b/src/backend/tsearch/wparser_def.c index 0648ec692e8..edebc2be20d 100644 --- a/src/backend/tsearch/wparser_def.c +++ b/src/backend/tsearch/wparser_def.c @@ -2439,6 +2439,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))