lynx-dev
[Top][All Lists]
Advanced

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

Re: LYNX-DEV Minor bugs in lynx2-7-1+fotemods


From: Foteos Macrides
Subject: Re: LYNX-DEV Minor bugs in lynx2-7-1+fotemods
Date: Sat, 10 May 1997 15:17:05 -0500 (EST)

address@hidden (Rick Mallett) wrote:
>In the process of debugging some local changes to lynx I downloaded an
>evaluation copy of Atria's Purify and tried it out on lynx2-7-1 plus
>fotemods.zip (May 8). It turned up a couple of interesting minor bugs
>both of which appear to have been in the code for quite some time.
>
>I'm not supplying a patch because I'm not sure what was intended and 
>I figured that whoever wrote the code would be in a better position to
>apply a fix. Anyway they appear to be minor problems.
>
>The first bug occurs in function `statusline' in LYUtils.c and it is
>simply that the array `buffer' in the following statement (about 30 lines
>into the routine) is a local variable and has not been initialized at this
>point in the code. 
>
>    if ((buffer[0] != '\0') &&
>        (LYHaveCJKCharacterSet)) {
>
>A statement such as "buffer[0] = '\0';" right at the beginning of the
>routine eliminates the problem as far as purify is concerned but hardly
>seems appropriate since the loop would never be executed.

        Ugh!, that typo has been there since I originally worked in
the CJK support.  It should be:

        if ((text[0] != '\0') &&
             ^^^^

My intent is to convert any CJK escape sequence to their di-byte
equivalents to reduce the likelihood of inappropriately truncating
the string so as to fit in the statusline window, and to truncate
at an appropriate point if it is necessary.  We do the same thing
in GridText.c when displaying the TITLE string, which must be
trunctated if it does not fit on one line.  But we bypass the calls
to the conversion functions if it's a zero-length string such that
there's nothing to convert.


>The second, and slightly more serious, problem occurs at line 1922 in
>LYCharUtils.c in function LYHandleMETA and results in a reference beyond
>the end of allocated memory. The problem statement is
>
>           while (*cp1) {
>
>in the code sequence 
>[...]
>       /*
>        *  Look for the Seconds field. - FM
>        */
>       cp = content;
>       while (*cp && isspace((unsigned char)*cp))
>           cp++;
>       if (*cp && isdigit(*cp)) {
>           cp1 = cp;
>           while (*cp1 && isdigit(*cp1))
>               cp1++;
>           *cp1 = '\0';
>           StrAllocCopy(Seconds, cp);
>           cp1++;
>       }
>[...]


        The bottom of that should be:

[...]
        if (*cp && isdigit(*cp)) {
            cp1 = cp;
            while (*cp1 && isdigit(*cp1))
                cp1++;
            if (*cp1)
                *cp1++ = '\0';
            StrAllocCopy(Seconds, cp);
        }
[...]

                                Fote

=========================================================================
 Foteos Macrides            Worcester Foundation for Biomedical Research
 address@hidden         222 Maple Avenue, Shrewsbury, MA 01545
=========================================================================
;
; 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]