<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>20313</bug_id>
          
          <creation_ts>2008-08-06 21:48:03 -0700</creation_ts>
          <short_desc>Add null check in String::fromUTF8()</short_desc>
          <delta_ts>2008-08-07 05:10:28 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Text</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>17432</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Alp Toker">alp</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>88018</commentid>
    <comment_count>0</comment_count>
    <who name="Alp Toker">alp</who>
    <bug_when>2008-08-06 21:48:03 -0700</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88019</commentid>
    <comment_count>1</comment_count>
      <attachid>22692</attachid>
    <who name="Alp Toker">alp</who>
    <bug_when>2008-08-06 21:51:25 -0700</bug_when>
    <thetext>Created attachment 22692
Add null checks</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88023</commentid>
    <comment_count>2</comment_count>
      <attachid>22692</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2008-08-06 22:43:12 -0700</bug_when>
    <thetext>Comment on attachment 22692
Add null checks

Looks fine.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88032</commentid>
    <comment_count>3</comment_count>
    <who name="Jan Alonzo">jmalonzo</who>
    <bug_when>2008-08-07 05:10:28 -0700</bug_when>
    <thetext>landed in r35623</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>22692</attachid>
            <date>2008-08-06 21:51:25 -0700</date>
            <delta_ts>2008-08-06 22:43:12 -0700</delta_ts>
            <desc>Add null checks</desc>
            <filename>string.patch</filename>
            <type>text/plain</type>
            <size>1298</size>
            <attacher name="Alp Toker">alp</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiAzNTYyMCkKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTYgQEAKKzIwMDgtMDgtMDYgIEFscCBUb2tlciAgPGFscEBudWFudGkuY29tPgor
CisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgIGh0dHBzOi8v
YnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD0yMDMxMworICAgICAgICBBZGQgbnVsbCBj
aGVjayBpbiBTdHJpbmc6OmZyb21VVEY4KCkKKworICAgICAgICBNYWtlIFN0cmluZzo6ZnJvbVVU
Rj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W5nKCk7CiAgICAgcmV0dXJuIFVURjhFbmNv
ZGluZygpLmRlY29kZShzdHJpbmcsIHN0cmxlbihzdHJpbmcpKTsKIH0KIAo=
</data>
<flag name="review"
          id="10054"
          type_id="1"
          status="+"
          setter="eric"
    />
          </attachment>
      

    </bug>

</bugzilla>