From cb0c8cbf316f9362c11d7a8356e6f459258ae78e Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Fri, 8 Apr 2016 21:25:14 +0300 Subject: [PATCH] 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 --- src/backend/tsearch/wparser_def.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/tsearch/wparser_def.c b/src/backend/tsearch/wparser_def.c index 2faa15ebd4..ca352af331 100644 --- a/src/backend/tsearch/wparser_def.c +++ b/src/backend/tsearch/wparser_def.c @@ -2465,6 +2465,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))