Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [bug] busyloop upon $=var with NULs when $IFS contains both NUL and a byte > 0x7f



> On 13/12/2022 09:49 Jun T <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
> > 2022/11/29 23:38, Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> > 
> >> On 29/11/2022 14:27 Jun. T <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
> >> 3834         for (; *s; r++) {                                                 
> >> 3835             char *ie = itype_end(s, ISEP, 1);               
> >> 3836             if (ie != s) {                                             
> >> 3837                 s = ie;                                                
> >> ....                          
> >> 3840             }                                          
> >> 3841             (void)findsep(&s, NULL, 0);
> >> ....
> >> 3845         }
> >> 
> >> Here, the pointer s already points to a ISEP (\x83\x20 = metafied Nul),
> >> but itype_end() can't find the next ISEP (ie == s) due to the empty
> >> ifs_wide, and findsep() does not move s because *s is already ISEP,
> >> resulting in infinite-loop with the same s.
> > 
> > I guess the obvious thing to do here is any time s doesn't move
> > give up splitting at that point.
> 
> How can we 'give up'?  Is it OK to call exit()?

By giving up, I meant we stop splitting at that point and leave the
rest of the string intact.  If splitting fails, stop splitting...

pws




Messages sorted by: Reverse Date, Date, Thread, Author