NetBSD-Bugs archive

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

Re: lib/47858: libedit widechar version mishandles EOF



On May 26,  9:30pm, linasvepstas%gmail.com@localhost (Linas Vepstas) wrote:
-- Subject: Re: lib/47858: libedit widechar version mishandles EOF

|  Just to be clear, here is a closer description of the problem.  The
|  offending lines are these:
|  
|  #ifdef WIDECHAR
|     if (el->el_flags & CHARSET_IS_UTF8) {
|        if (!utf8_islead((unsigned char)cbuf[0]))
|           goto again; /* discard the byte we read and try again */
|  
|  When an EOF is read, cbuf[0] contains some sort of undefined garbage,
|  left over from a previous read, thus the goto again is taken.  The
|  non-widechar version doesn't have this problem, and thus perhaps my
|  earlier patch is too general/too broad.  I believe it's a great patch,
|  but if you don't like it, the below is a more conservative patch:

I understand, I moved it outside the WIDECHAR conditional because it
should apply to the normal case too.

thanks,

christos



Home | Main Index | Thread Index | Old Index