Bug 48946 - Crash under WebCore::platformDefaultLanguage() when using Arabic language
Summary: Crash under WebCore::platformDefaultLanguage() when using Arabic language
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh All
: P1 Normal
Assignee: Mike Thole
Keywords: InRadar
Depends on:
Reported: 2010-11-03 13:27 PDT by Mike Thole
Modified: 2010-11-08 20:41 PST (History)
1 user (show)

See Also:

Proposed patch (2.38 KB, patch)
2010-11-03 13:38 PDT, Mike Thole
ap: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Thole 2010-11-03 13:27:51 PDT
After choosing the Arabic locale, launching Safari and navigating somewhere will cause a crash:

   1 libobjc.A.dylib                0x7fff82ae8318 objc_msgSend_vtable13 + 0x10
>  2 com.apple.WebCore              0x101e0a5bd WebCore::platformDefaultLanguage() + 0x3d (Language.mm:100)
   3 com.apple.WebCore              0x101e09e38 WebCore::defaultLanguage() + 0x38 (Language.cpp:72)
   4 com.apple.WebKit               0x1012c9cc9 +[NSUserDefaults(WebNSUserDefaultsExtras) _webkit_preferredLanguageCode] + 0x19 (WebNSUserDefaultsExtras.mm:40)
   5 com.apple.WebKit               0x1012fb835 +[WebView(WebPrivate) _standardUserAgentWithApplicationName:] + 0x55 (WebView.mm:550)
   6 com.apple.Safari.framework     0x10020ae15 Safari::SWebView::defaultUserAgent() + 0x47 (SWebView.mac.mm:166)
Comment 1 Mike Thole 2010-11-03 13:38:42 PDT
Created attachment 72863 [details]
Proposed patch
Comment 2 Alexey Proskuryakov 2010-11-03 13:49:43 PDT
Comment on attachment 72863 [details]
Proposed patch

Comment 3 Mike Thole 2010-11-03 13:55:28 PDT
Committed revision 71264.
Comment 4 Darin Adler 2010-11-03 14:14:23 PDT
Comment on attachment 72863 [details]
Proposed patch

View in context: https://bugs.webkit.org/attachment.cgi?id=72863&action=review

> WebCore/platform/mac/Language.mm:62
> +    NSString *httpStyleLanguageCode = nil;

It would be clearer to define this just before it’s initialized rather than putting the definition at the top of the function. If you did that it would be clear you need not set it to nil since it’s already initialized in all code paths.

> WebCore/platform/mac/Language.mm:79
> +    }
> +    else

We put the } on the same line as the “else” in WebKit coding style.
Comment 5 Mike Thole 2010-11-03 14:46:21 PDT
Tweaked style per Darin's comments in r71271.
Comment 6 Alexey Proskuryakov 2010-11-08 20:41:10 PST