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

Commit0b1ee9b

Browse files
committed
fix hlfinditem function. Thanks to "Stphane Bidoul" <stephane.bidoul@softwareag.com>.
The 'word' variable there is initialised fromthe prs->words array, but immediately after,that array may be reallocated, thus leavingword pointing to unallocated memory.
1 parent22c0b1f commit0b1ee9b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

‎contrib/tsearch2/expected/tsearch2.out

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,11 +2056,11 @@ An hour of storm to place
20562056
The sculpture of these granite seams,
20572057
Upon a woman s face. E. J. Pratt (1882 1964)
20582058
', to_tsquery('granite&sea'));
2059-
headline
2060-
----------------------------------------------------------------------------------------------
2061-
<b>sea</b>an hour one night
2062-
An hour of stormtoplace
2063-
Thesculpture of these<b>granite</b>
2059+
headline
2060+
--------------------------------------------------------------------------------------------------
2061+
<b>sea</b>a thousand years,
2062+
A thousand yearstotrace
2063+
The <b>granite</b> features of this cliff
20642064
(1 row)
20652065

20662066

‎contrib/tsearch2/ts_cfg.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,14 +360,15 @@ hlfinditem(HLPRSTEXT * prs, QUERYTYPE * query, char *buf, int buflen)
360360
{
361361
inti;
362362
ITEM*item=GETQUERY(query);
363-
HLWORD*word=&(prs->words[prs->curwords-1]);
363+
HLWORD*word;
364364

365365
while (prs->curwords+query->size >=prs->lenwords)
366366
{
367367
prs->lenwords *=2;
368368
prs->words= (HLWORD*)repalloc((void*)prs->words,prs->lenwords*sizeof(HLWORD));
369369
}
370370

371+
word=&(prs->words[prs->curwords-1]);
371372
for (i=0;i<query->size;i++)
372373
{
373374
if (item->type==VAL&&item->length==buflen&&strncmp(GETOPERAND(query)+item->distance,buf,buflen)==0)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp