Bug 48521 - [GTK] Crash in TextEncoding.cpp when using glib unicode
Summary: [GTK] Crash in TextEncoding.cpp when using glib unicode
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-28 07:06 PDT by Carlos Garcia Campos
Modified: 2010-10-29 15:15 PDT (History)
1 user (show)

See Also:


Attachments
Patch to fix the crash (1.48 KB, patch)
2010-10-28 07:10 PDT, Carlos Garcia Campos
no flags 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 2010-10-28 07:06:57 PDT
In TextEncoding::encode() we need to convert the utf16 input string to utf8 to normalize it using g_utf8_normalize(). We are assuming that the conversion always work, but when it fails g_utf8_normalize() crashes due to NULL pointer. It's reproducible with some of the fast/url tests:


Testing 20 test cases.
fast/url .
fast/url/anchor.html -> crashed
...
fast/url/host.html -> failed
.......
fast/url/query.html -> crashed
.......
fast/url/standard-url.html -> crashed
..
0.96s total testing time

16 test cases (80%) succeeded
1 test case (5%) had incorrect layout
3 test cases (15%) crashed
Starting webkit launcher.
Comment 1 Carlos Garcia Campos 2010-10-28 07:10:47 PDT
Created attachment 72187 [details]
Patch to fix the crash

When utf8 conversion fails, just try with the original string
Comment 2 Andreas Kling 2010-10-28 07:22:29 PDT
Comment on attachment 72187 [details]
Patch to fix the crash

Nice catch, r=me
Comment 3 WebKit Commit Bot 2010-10-29 15:15:13 PDT
Comment on attachment 72187 [details]
Patch to fix the crash

Clearing flags on attachment: 72187

Committed r70935: <http://trac.webkit.org/changeset/70935>
Comment 4 WebKit Commit Bot 2010-10-29 15:15:18 PDT
All reviewed patches have been landed.  Closing bug.