BUG #16097: ts_headline fails on text with html style tag - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #16097: ts_headline fails on text with html style tag
Date
Msg-id 16097-4724fa53dd5a23d2@postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      16097
Logged by:          Stanislav B.
Email address:      godstanis@gmail.com
PostgreSQL version: 12.0
Operating system:   Linux. Ubuntu 18 and 16
Description:

'ts_headline' function behaves really strang on text with '<style>' tags.

Scenario #1:
Set up: any text with <style> tag, containing any text under 2043 symbols;
Result: works as expected, no problems.

Scenario #2:
Set up: any text (use the sample code at the bottom of my message) with
<style> tag, containing any text (but more than 2043-2045 symbols);
Result: fails to process correctly, text with empty "<style><style>" tag
returned.

Scenario #3:
Set up: Take THE SAME setup from #2 scenario, but just rename "style" tag to
anything else, let's use "stylk". (You can take the sample code below and
change the tag);
Result: works as expected, no problems.

As you see, the problem occurs only if we use "style" tag here.

Here is the minimum sample code to reproduce the error:

>> CODE START
select ts_headline(
               '<h1>Ok</h1> <style type="text/css">.some-content {color:
grey} .some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} * {}</style> <p>Any
other content not affected</p>',
               'anything'::tsquery,
               'HighlightAll="1"'
           );
>>CODE END


pgsql-bugs by date:

Previous
From: Devrim Gündüz
Date:
Subject: Re: BUG #16085: Potential missing version information available for/usr/pgsql-12/lib/libpq.so.5
Next
From: Tom Lane
Date:
Subject: Re: PostgreSQL 12 installation fails because locale name contained non-english characters