Bug 20313

Summary: Add null check in String::fromUTF8()
Product: WebKit Reporter: Alp Toker <alp>
Component: TextAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 17432    
Attachments:
Description Flags
Add null checks eric: review+

Alp Toker
Reported 2008-08-06 21:48:03 PDT
String::fromUTF8() crashes when passed a null pointer. This behaviour is inconsistent with the other constructors, which return a null String() in this case: String::String(const char* str) { if (!str) return; m_impl = StringImpl::create(str); } String::String(const char* str, unsigned length) { if (!str) return; m_impl = StringImpl::create(str, length); } Fix attached. This allows us to simplify (or avoid) null checking logic wherever String::fromUTF8() is used.
Attachments
Add null checks (1.27 KB, patch)
2008-08-06 21:51 PDT, Alp Toker
eric: review+
Alp Toker
Comment 1 2008-08-06 21:51:25 PDT
Created attachment 22692 [details] Add null checks
Eric Seidel (no email)
Comment 2 2008-08-06 22:43:12 PDT
Comment on attachment 22692 [details] Add null checks Looks fine.
Jan Alonzo
Comment 3 2008-08-07 05:10:28 PDT
landed in r35623
Note You need to log in before you can comment on or make changes to this bug.