[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Xterm Bidi/Shaping/etc Patch
Hello Robert,
I tried to run xterm-150 with and without the patch.
Without the patch everything seems ok. With the patch xterm
* sucks up huge gobs of memory ( a rise from 3256K to 50M (!) within
minutes )
* crashes quickly.
I traced down:
----
screen.c::798:
#if OPT_WIDE_CHARS
lefter = (chars[lastind-1] + (WIDEC(lastind-1) << 8));
In the initiazition phase, chars[-1] is accessed, because lastind is
zero. This seems at least strange.
----
screen.c::1020:
/* adjust to redraw all of a widechar if we just wanted
to draw the right hand half */
if (iswide(chars[leftcol - 1] | (widec[leftcol -1]<<8)) &&
(chars[leftcol] | (widec[leftcol]<<8))==HIDDEN_CHAR)
leftcol can be 0, and is not checked. Access of chars[-1] results.
This is not good if the first row is concerned :(.
----
screen.c::776:
chars = malloc(screen->max_col+1);
widec = malloc(screen->max_col+1);
But anyway, on line 798 there is:
righter = screen->wide_chars ? (((comb1l[col]|(comb1h[col])<<8) == ZWNJ ? 0 :
(chars[col] + (WIDEC(col) << 8)))) : 0;
and a check reveals that
col > screen->max_col
can appear !!! ( the variable col is passed in to
ActuallyDraw as parameter ). ?
This results in a crash if xterm is compiled with -O2.
----
I added a few comments, the whole thing might be shifted by a few lines.
The C++ -style comments ( // ) are maybe not such a good idea, if xterm
is not compiled with a C++-compiler.
I which you'd find a good fix for these errors ( I don't know the code
well enough ), because I'd hate to miss the features :)
thanks,
Karl
-
Linux-UTF8: i18n of Linux on all levels
Archive: http://mail.nl.linux.org/lists/