lynx-dev
[Top][All Lists]
Advanced

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

LYNX-DEV A possible bugfix (was: lynx crashes on this url)


From: Klaus Weide
Subject: LYNX-DEV A possible bugfix (was: lynx crashes on this url)
Date: Wed, 26 Mar 1997 09:55:36 -0600 (CST)

...
> > > Lynx crashes when you select the download link off this page, 
> > > http://www.ecsnet.com/html/21-p0298.html
> > > It prompts to download or cancel, gets the file, asks to save as, which I
> > > hit enter on, then gets a sig11 and dumps core..
... 
> I looked at lynx's trace, didn't see anything there, didn't think to try
> strace on linux..  Still strange behaviour..
> 
> > I think I'll ask ecsnet.com why they have text files as x-gzip though :)
> > Sorry I can't help, I'll gladly send a strace or whatever..
> 
> I did send the web page's maintainer a note about the page, I'm curious why it
> causes problems at all tho..

They changed it now to return "application/x-patch" instead.
But I am not sure that "solves" the problem.  
On the other hand I am not sure that there *was* a problem when either
Lynx+current bugfixes or the development code from sol.slcc.edu was used.

Here is a patch for src/HTFWriter.c (created against devel code, also
works for official 2.7 with some fuzz) which may or may not be related to
the problem.

Explanation: HTFWriter_free() would access a memory stucture that could be
invalid at that point.  We should save the contents of *pres we want
instead of a pointer to the structure.  See also double "yuk"
in HTFormat.c.

  Klaus

Index: lynx2-7/src/HTFWriter.c
*** lynx2-7/src/HTFWriter.c.orig Fri, 21 Mar 1997 13:30:44 -0700 kweide 
(Lynx/d/2_HTFWriter. 1.1.2.1 644)
--- lynx2-7/src/HTFWriter.c      Wed, 26 Mar 1997 00:37:37 -0700 kweide 
(Lynx/d/2_HTFWriter. 1.1.2.1 644)
***************
*** 71,77 ****
        FILE *                  fp;             /* The file we've opened */
        char *                  end_command;    /* What to do on _free.  */
        char *                  remove_command; /* What to do on _abort. */
!       HTPresentation *        pres;       /* Original stream's pres.   */
        HTParentAnchor *        anchor;     /* Original stream's anchor. */
        HTStream *              sink;       /* Original stream's sink.   */
  };
--- 71,78 ----
        FILE *                  fp;             /* The file we've opened */
        char *                  end_command;    /* What to do on _free.  */
        char *                  remove_command; /* What to do on _abort. */
!         HTFormat              input_format;  /* Original pres->rep     */
!         HTFormat              output_format; /* Original pres->rep_out */
        HTParentAnchor *        anchor;     /* Original stream's anchor. */
        HTStream *              sink;       /* Original stream's sink.   */
  };
***************
*** 154,160 ****
            }
        } else
  #endif /* VMS */
!       if (me->pres->rep == HTAtom_for("www/compressed")) {
            /*
             *  It's a compressed file supposedly cached to
             *  a temporary file for uncompression. - FM
--- 155,161 ----
            }
        } else
  #endif /* VMS */
!       if (me->input_format == HTAtom_for("www/compressed")) {
            /*
             *  It's a compressed file supposedly cached to
             *  a temporary file for uncompression. - FM
***************
*** 223,232 ****
  #endif
                    status = HTLoadFile(addr,
                                        me->anchor,
!                                       me->pres->rep_out,
                                        me->sink);
                    if (dump_output_immediately &&
!                       me->pres->rep_out == HTAtom_for("www/present")) {
                        FREE(addr);
                        remove(me->anchor->FileCache);
                        FREE(me->anchor->FileCache);
--- 224,233 ----
  #endif
                    status = HTLoadFile(addr,
                                        me->anchor,
!                                       me->output_format,
                                        me->sink);
                    if (dump_output_immediately &&
!                       me->output_format == HTAtom_for("www/present")) {
                        FREE(addr);
                        remove(me->anchor->FileCache);
                        FREE(me->anchor->FileCache);
***************
*** 355,361 ****
      me->fp = fp;
      me->end_command = NULL;
      me->remove_command = NULL;
-     me->pres = NULL;
      me->anchor = NULL;
      me->sink = NULL;
  
--- 356,361 ----
***************
*** 436,442 ****
      if (me == NULL)
          outofmem(__FILE__, "HTSaveAndExecute");
      me->isa = &HTFWriter;
!     me->pres = pres;
      me->anchor = anchor;
      me->sink = sink;
      
--- 436,443 ----
      if (me == NULL)
          outofmem(__FILE__, "HTSaveAndExecute");
      me->isa = &HTFWriter;
!     me->input_format = pres->rep;
!     me->output_format = pres->rep_out;
      me->anchor = anchor;
      me->sink = sink;
      
***************
*** 553,559 ****
      ret_obj->isa = &HTFWriter;
      ret_obj->remove_command = NULL;
      ret_obj->end_command = NULL;
!     ret_obj->pres = pres;
      ret_obj->anchor = anchor;
      ret_obj->sink = sink;
  
--- 554,561 ----
      ret_obj->isa = &HTFWriter;
      ret_obj->remove_command = NULL;
      ret_obj->end_command = NULL;
!     ret_obj->input_format = pres->rep;
!     ret_obj->output_format = pres->rep_out;
      ret_obj->anchor = anchor;
      ret_obj->sink = sink;
  
***************
*** 788,796 ****
         *  We have no idea what we're dealing with,
         *  so treat it as a binary stream. - FM
         */
!         StrAllocCopy(type, "application/octet-stream");
!       format = HTAtom_for(type);
!       FREE(type)
        me = HTStreamStack(format, pres->rep_out, sink, anchor);
        return me;
      }
--- 790,796 ----
         *  We have no idea what we're dealing with,
         *  so treat it as a binary stream. - FM
         */
!       format = HTAtom_for("application/octet-stream");
        me = HTStreamStack(format, pres->rep_out, sink, anchor);
        return me;
      }
***************
*** 856,862 ****
      if (me == NULL)
          outofmem(__FILE__, "HTCompressed");
      me->isa = &HTFWriter;
!     me->pres = pres;
      me->anchor = anchor;
      me->sink = sink;
  
--- 856,863 ----
      if (me == NULL)
          outofmem(__FILE__, "HTCompressed");
      me->isa = &HTFWriter;
!     me->input_format = pres->rep;
!     me->output_format = pres->rep_out;
      me->anchor = anchor;
      me->sink = sink;
  


;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

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