Re: linemode diffs for HText callbacks

Raffaele,

I'm able to make the browser crash on a certain number of
pages with poorly formed links.  (nested links, extra </a>
with no matching <a>.)

For well-formed pages with anchors, I get *_beginAnchor on a
stack that looks like
	LMHText_beginAnchor() at GridText.c:765
	HTextImp_foundLink() at HText.c:107
	HTML_start_element() at HTML.c:204
	start_element() at SGML.c:203
	SGML_write() at SGML.c:290
	...et cetera..
(Line numbers are from my 5.2.6 code.)
For pages where the first link has already gone by,

This is a result of my registering LMHText_beginAnchor() as a
callback.  Possibly, it needs to be broken in two parts, which
  * capture link info, remaining in the callback.
  * deal with presentation (in this case, assign a link number),
    invoked from with LMHText_beginElement().

A simplistic fix to go inside LMText_endAnchor() in
GridText.c...

*** 787,792 ****
--- 787,794 ----
  {
      TextAnchor * a = text->last_anchor;
      char marker[100];
+     if (!a)  /* *_beginAnchor not yet called */
+       return;
      if (a->number && display_anchors) {        /* If it goes somewhere */
        sprintf(marker, end_reference, a->number);
        HText_appendText(text, marker);

This fixes the above crash cases, and tends to convert extra
</a> into repeats of last link number.

--Rick Kwan
  rick.kwan@lightsaber.com


On Thu, 24 Jun 1999, Raffaele Sena wrote:

> > >The diffs below allow the linemode browser to compile and run
> > >with libwww-5.2.6 and above.  The major enhancement is the use of
> > >callbacks registered to the HText interface.
> > 
> > Cool - committed - see
> > 
> > http://dev.w3.org/cgi-bin/cvsweb/libwww/LineMode/src/
> > 
> 
> I did a simple fix to prevent a crash on pages with anchors
> (*_endAnchor was called but *_beginAnchor wasn't) see:
> 
> http://dev.w3.org/cgi-bin/cvsweb/libwww/LineMode/src/GridText.c
> 
> -- Raffaele
> 

Received on Friday, 25 June 1999 10:39:16 UTC