Fix for infinite loop in bidi.cpp

George Staikos staikos at kde.org
Mon Nov 24 16:13:27 GMT 2003


On Monday 24 November 2003 11:06, David Faure wrote:
> Testcase:
> www.expedia.ca, "destinations" tab, Acapulco, type 'New York' in 'departing
> from', and tomorrow in the departure date.
> I had a reproduceable infinite loop in RenderBlock::layoutInilineChildren,
> due to findNextLineBreak going back and forth.
>
> start and end were 1 and 34, then 34 and 1, then 1 and 34 etc.
>
> Index: bidi.cpp
> ===================================================================
> RCS file: /home/kde/kdelibs/khtml/rendering/bidi.cpp,v
> retrieving revision 1.174
> diff -u -p -r1.174 bidi.cpp
> --- bidi.cpp    3 Nov 2003 18:06:13 -0000       1.174
> +++ bidi.cpp    24 Nov 2003 16:04:08 -0000
> @@ -1311,7 +1311,7 @@ BidiIterator RenderBlock::findNextLineBr
>             QChar *str = t->text();
>              if (style()->whiteSpace() == NOWRAP ||
> t->style()->whiteSpace() == NOWRAP) { tmpW += t->maxWidth();
> -                pos = len;
> +                pos = strlen;
>                  len = 0;
>              } else {
>                  const Font *f = t->htmlFont( m_firstLine );
>
> (amazing that this code hasn't changed for a year, and we didn't get this
> before...)

  Wow, you caught it!  This bug has been reported, and there are testcases for 
it.  We just couldn't figure out where the problem was.  Nice work. :)  Have 
a search for bidi in bugs.kde.org and you might find the old report.  I was 
working on it for a while but gave up when Dirk told me this code was being 
rewritten anyways.

-- 
George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/




More information about the kfm-devel mailing list