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

Infinite loop in compprintfmt() (complist.c rev 1.91)



Here's a gdb walk-through -- note we return to line 896 (really the loop
at 892) without ever incrementing the loop variable.

892         for (p = fmt; *p; ) {
893             convchar_t cchar;
894             int len, width;
(gdb) n
896             len = MB_METACHARLENCONV(p, &cchar);
(gdb) n
898             if (cchar == WEOF) {
(gdb) n
904                 width = WCWIDTH(cchar);
(gdb) n
906             if (doesc && cchar == ZWC('%')) {
(gdb) n
1043                cc += width;
(gdb) n
1045                if ((cc >= columns - 2 || cchar == ZWC('\n')) && stat)
(gdb) n
1047                if (cchar == ZWC('\n')) {
(gdb) n
1053                if (dopr == 1) {
(gdb) n
896             len = MB_METACHARLENCONV(p, &cchar);

The call is from line 1557, dopr = 0:

1554            if (subcols)
1555                ret = clprintfmt(&mcolors, m->disp, ml);
1556            else {
1557                compprintfmt(m->disp, 0, 1, 0, ml, &stop);
1558                if (stop)
1559                    ret = 1;
1560            }

I was only able to get the loop to happen by accident -- something having
to do with invoking execute-named-command in the middle of menu-selection.
So I'm not able to reproduce it, and don't know if the right thing is to
simply increment p when dopr != 1 ?  PWS, gotta clue?



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