Bug 103139 - [ENCHANT] Infinite loop when end word position is not found
Summary: [ENCHANT] Infinite loop when end word position is not found
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on:
Blocks:
 
Reported: 2012-11-23 06:46 PST by Carlos Garcia Campos
Modified: 2012-11-23 08:41 PST (History)
5 users (show)

See Also:


Attachments
Patch (7.89 KB, patch)
2012-11-23 06:51 PST, Carlos Garcia Campos
mrobinson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2012-11-23 06:46:54 PST
The problem is that in TextCheckerEnchant::checkSpellingOfString() the inner loop that looks for the end of the word doesn't break when end > numberOfCharacters.
Comment 1 Carlos Garcia Campos 2012-11-23 06:51:48 PST
Created attachment 175799 [details]
Patch

We could just fix the infinite loop by adding the check to break the inner loop, but the code can be optimized and simplified a lot using the word iterator to iterate the words and it also fixes the infinite loop.
Comment 2 Martin Robinson 2012-11-23 07:59:00 PST
Comment on attachment 175799 [details]
Patch

Great. As long as tests pass this look like an incredible improvement.
Comment 3 Martin Robinson 2012-11-23 08:00:59 PST
You might want to double-check this patch before landing. At some point it seemed that the TextIterators did not support nested iterators. Perhaps that's been changed in WebCore though. This is an issue because the spell checker is called while walking through a text iterator at some points.
Comment 4 Carlos Garcia Campos 2012-11-23 08:41:25 PST
Committed r135618: <http://trac.webkit.org/changeset/135618>