fix hlfinditem function. Thanks to "Stphane Bidoul" <stephane.bidoul@softwareag.com>.
The 'word' variable there is initialised from the prs->words array, but immediately after, that array may be reallocated, thus leaving word pointing to unallocated memory.
This commit is contained in:
parent
22c0b1f0f4
commit
0b1ee9b5a3
@ -2056,11 +2056,11 @@ An hour of storm to place
|
|||||||
The sculpture of these granite seams,
|
The sculpture of these granite seams,
|
||||||
Upon a woman s face. E. J. Pratt (1882 1964)
|
Upon a woman s face. E. J. Pratt (1882 1964)
|
||||||
', to_tsquery('granite&sea'));
|
', to_tsquery('granite&sea'));
|
||||||
headline
|
headline
|
||||||
----------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------------
|
||||||
<b>sea</b> an hour one night
|
<b>sea</b> a thousand years,
|
||||||
An hour of storm to place
|
A thousand years to trace
|
||||||
The sculpture of these <b>granite</b>
|
The <b>granite</b> features of this cliff
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ hlfinditem(HLPRSTEXT * prs, QUERYTYPE * query, char *buf, int buflen)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
ITEM *item = GETQUERY(query);
|
ITEM *item = GETQUERY(query);
|
||||||
HLWORD *word = &(prs->words[prs->curwords - 1]);
|
HLWORD *word;
|
||||||
|
|
||||||
while (prs->curwords + query->size >= prs->lenwords)
|
while (prs->curwords + query->size >= prs->lenwords)
|
||||||
{
|
{
|
||||||
@ -368,6 +368,7 @@ hlfinditem(HLPRSTEXT * prs, QUERYTYPE * query, char *buf, int buflen)
|
|||||||
prs->words = (HLWORD *) repalloc((void *) prs->words, prs->lenwords * sizeof(HLWORD));
|
prs->words = (HLWORD *) repalloc((void *) prs->words, prs->lenwords * sizeof(HLWORD));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
word = &(prs->words[prs->curwords - 1]);
|
||||||
for (i = 0; i < query->size; i++)
|
for (i = 0; i < query->size; i++)
|
||||||
{
|
{
|
||||||
if (item->type == VAL && item->length == buflen && strncmp(GETOPERAND(query) + item->distance, buf, buflen) == 0)
|
if (item->type == VAL && item->length == buflen && strncmp(GETOPERAND(query) + item->distance, buf, buflen) == 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user