lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lynx-dev] Multi-line highlighting vs. the "Double Check"


From: Thomas Dickey
Subject: Re: [Lynx-dev] Multi-line highlighting vs. the "Double Check"
Date: Wed, 7 Dec 2005 17:40:04 -0500 (EST)

On Thu, 8 Dec 2005, Andrew Belov wrote:


Can anyone tell the reason behind the size check in
HText_trimHightext()?

yes, it was part of this fix:

* add limit checks in HText_trimHightext() to fix an infinite loop visiting
  this site (which contains a form with only hidden input fields):
  1- http://www.ibazar.com.br/
  2- Click "Cadastro" and accept all cookies
  3- Click "[accepte.gif]"
  (reported by Frederic L W Meunier) -TD

            /*
             * Double check that we have a line pointer, and if so, copy
into
             * highlight text.
             */
            if (line_ptr2
                && line_ptr2->size) {

It traces back to 2.8.5dev.8 as a part of solution for hangs on empty
hidden links (the patch also introduced a more relevant exit condition a
few lines higher). Now this additional check conflicts with multi-line
links found in some quirky documents, e.g.:

<a href>Line 1<p>Line 2<p>Line 3</a>
<hr>
<a href>Line A<br>&nbsp;<br>Line B<br>&nbsp;<br>Line C</a>

Both links are first rendered interspersed by empty lines, but these
empty lines never become known to highlight code as a result of the
"Double Check", so the screen gets clobbered.

But past that chunk, it does this:

                StrnAllocCopy(hi_string,
                              line_ptr2->data,
                              (actual_len - hilite_len));

which doesn't seem to make sense if line_ptr2's size is zero (there
should be no data to copy).  If I'm not misunderstanding it, what
probably is needed is some special check to make the loop continue
to the next line by satisfying the loop condition:

        while (actual_len > hilite_len) {
...
                actual_len -= strlen(hi_string);

The easy solution (removing "&& line_ptr2->size") seems to fix this
nuisance, but considering that a more severe bug is involved I wouldn't
dare to propose this as a patch. Comments are welcome.

What I'd do in this case (perhaps this weekend) would be to see what
the variables are in this chunk while running the test-case you showed.

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]