WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
94202
[GTK] Bad utf8 data is being passed to enchant_dict_check
https://bugs.webkit.org/show_bug.cgi?id=94202
Summary
[GTK] Bad utf8 data is being passed to enchant_dict_check
Mario Sanchez Prada
Reported
2012-08-16 00:54:57 PDT
I observed today the following error in the bots, when running certain layout tests like the following one: 23:47:55.622 4977 worker/22 editing/selection/move-by-word-visually-single-space-inline-element.html output stderr lines: 23:47:55.622 4977 enchant_dict_check: assertion `g_utf8_validate(word, len, NULL)' failed 23:47:55.622 4977 enchant_dict_check: assertion `g_utf8_validate(word, len, NULL)' failed 23:47:55.623 4977 enchant_dict_check: assertion `g_utf8_validate(word, len, NULL)' failed 23:47:55.623 4977 enchant_dict_check: assertion `g_utf8_validate(word, len, NULL)' failed [...] << repeats some more times >> So, I briefly investigated the issue and it seems the problem is easily fixable by doing this: --- a/Source/WebCore/platform/text/gtk/TextCheckerEnchant.cpp +++ b/Source/WebCore/platform/text/gtk/TextCheckerEnchant.cpp @@ -115,7 +115,7 @@ void TextCheckerEnchant::checkSpellingOfString(const String& string, int& misspe g_utf8_strncpy(word.get(), cstart, wordLength); for (; dictIter != m_enchantDictionaries.end(); ++dictIter) { - if (enchant_dict_check(*dictIter, word.get(), wordLength)) { + if (enchant_dict_check(*dictIter, word.get(), bytes)) { misspellingLocation = start; misspellingLength = wordLength; } else { The explanation is that the 'length' parameter in enchant_dict_check accepts a number of bytes and not the number of utf8 characters, so it will fail in cases like this: word: דעפ => total characters: 3 / total bytes: 6 Thus, of course a call to enchant_dict_check with 3 as length will fail
Attachments
Patch proposal
(2.42 KB, patch)
2012-08-16 00:59 PDT
,
Mario Sanchez Prada
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Mario Sanchez Prada
Comment 1
2012-08-16 00:59:10 PDT
Created
attachment 158741
[details]
Patch proposal Here comes the patch
Mario Sanchez Prada
Comment 2
2012-08-16 10:12:48 PDT
Comment on
attachment 158741
[details]
Patch proposal I am lazy
WebKit Review Bot
Comment 3
2012-08-16 10:33:46 PDT
Comment on
attachment 158741
[details]
Patch proposal Clearing flags on attachment: 158741 Committed
r125791
: <
http://trac.webkit.org/changeset/125791
>
WebKit Review Bot
Comment 4
2012-08-16 10:33:49 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug