Bug 48521

Summary: [GTK] Crash in TextEncoding.cpp when using glib unicode
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Patch to fix the crash none

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.