<?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>149957</bug_id>
          
          <creation_ts>2015-10-09 09:08:17 -0700</creation_ts>
          <short_desc>[Win] Null pointer crash.</short_desc>
          <delta_ts>2017-01-16 13:01:10 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>peavo</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>daniel.zimmerman</cc>
    
    <cc>fpizlo</cc>
    
    <cc>ggaren</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1131925</commentid>
    <comment_count>0</comment_count>
    <who name="">peavo</who>
    <bug_when>2015-10-09 09:08:17 -0700</bug_when>
    <thetext>I just got a null pointer crash in JSC::speculationFromCell(). The JSCell object looks more or less ok, but the m_structureID member is 0, causing the null pointer crash. 


JavaScriptCore.dll!JSC::speculationFromCell(JSC::JSCell * cell)  Line 363 + 0x20 bytes	C++
JavaScriptCore.dll!JSC::speculationFromValue(JSC::JSValue value)  Line 391 + 0x8 bytes	C++
JavaScriptCore.dll!JSC::ValueProfileBase&lt;1&gt;::computeUpdatedPrediction(const JSC::ConcurrentJITLocker &amp; __formal)  Line 145 + 0x7 bytes	C++
JavaScriptCore.dll!JSC::CodeBlock::updateAllPredictionsAndCountLiveness(unsigned int &amp; numberOfLiveNonArgumentValueProfiles, unsigned int &amp; numberOfSamplesInProfiles)  Line 3770	C++
JavaScriptCore.dll!JSC::CodeBlock::updateAllPredictions()  Line 3815	C++
JavaScriptCore.dll!operationOptimize(JSC::ExecState * exec, int bytecodeIndex)  Line 1142	C++</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1131926</commentid>
    <comment_count>1</comment_count>
      <attachid>262776</attachid>
    <who name="">peavo</who>
    <bug_when>2015-10-09 09:11:21 -0700</bug_when>
    <thetext>Created attachment 262776
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1131929</commentid>
    <comment_count>2</comment_count>
    <who name="">peavo</who>
    <bug_when>2015-10-09 09:13:22 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; Created attachment 262776 [details]
&gt; Patch

I&apos;m not sure this is the correct way to deal with this crash :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1131930</commentid>
    <comment_count>3</comment_count>
      <attachid>262776</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2015-10-09 09:16:06 -0700</bug_when>
    <thetext>Comment on attachment 262776
Patch

While this might fix the crash, I think it&apos;s the wrong fix.

A cell with a null structureID has been garbage collected. You&apos;re lucky if you find the null structureID -- that happens soon after sweeping. If you&apos;re unlucky, you&apos;ll just get garbage memory, or a crash.

We need to investigate how cell got garbage collected in the first place.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1131933</commentid>
    <comment_count>4</comment_count>
    <who name="">peavo</who>
    <bug_when>2015-10-09 09:20:44 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; Comment on attachment 262776 [details]
&gt; Patch
&gt; 
&gt; While this might fix the crash, I think it&apos;s the wrong fix.
&gt; 
&gt; A cell with a null structureID has been garbage collected. You&apos;re lucky if
&gt; you find the null structureID -- that happens soon after sweeping. If you&apos;re
&gt; unlucky, you&apos;ll just get garbage memory, or a crash.
&gt; 
&gt; We need to investigate how cell got garbage collected in the first place.

Ok, sounds good :)

This is the state of the JSCell object when the crash occured:

m_structureID   0x00000000 JSC::Structure*
m_indexingType  0          unsigned char
m_type          StringType JSC::JSType
m_flags         224        unsigned char
m_cellState     NewWhite   JSC::CellState</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1267203</commentid>
    <comment_count>5</comment_count>
    <who name="Dan Zimmerman">daniel.zimmerman</who>
    <bug_when>2017-01-16 13:01:10 -0800</bug_when>
    <thetext>I&apos;ve found a similar crash on iOS 10.2&apos;s version of JavascriptCore.

I have the following backtrace:

#0	0x0000000104d6d2ef in JSC::speculationFromCell(JSC::JSCell*) ()
#1	0x00000001047d2ec3 in JSC::CodeBlock::updateAllPredictionsAndCountLiveness(unsigned int&amp;, unsigned int&amp;) ()
#2	0x00000001047cebc7 in JSC::CodeBlock::stronglyVisitStrongReferences(JSC::SlotVisitor&amp;) ()
#3	0x00000001047ce969 in JSC::CodeBlock::visitChildren(JSC::SlotVisitor&amp;) ()
#4	0x0000000104d699ac in JSC::SlotVisitor::drain() ()
#5	0x0000000104a0869c in JSC::Heap::markRoots(double, void*, void*, int (&amp;) [37]) ()
#6	0x0000000104a0b065 in JSC::Heap::collectImpl(JSC::HeapOperation, void*, void*, int (&amp;) [37]) ()
#7	0x0000000104a0ada1 in JSC::Heap::collect(JSC::HeapOperation) ()
#8	0x0000000104c3c957 in JSC::MarkedAllocator::allocateSlowCase(unsigned long) ()
#9	0x0000000104b72ee0 in JSObjectMake ()

and the state of the JSCell is:

m_structureID: 0
m_indexingType: 0
m_type: UnspecifiedType (0)
m_flags: 0
m_cellState: AnthraciteOrBlack (0)

Is there anyway I can help to find the source of the issue? I have a setup where the bug is pretty reproducible.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>262776</attachid>
            <date>2015-10-09 09:11:21 -0700</date>
            <delta_ts>2015-10-09 09:16:06 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-149957-20151009181031.patch</filename>
            <type>text/plain</type>
            <size>1323</size>
            <attacher>peavo</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gU291
cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkocmV2aXNpb24gMTkwODAxKQorKysgU291cmNl
L0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDE1IEBA
CisyMDE1LTEwLTA5ICBQZXIgQXJuZSBWb2xsYW4gIDxwZWF2b0BvdXRsb29rLmNvbT4KKworICAg
ICAgICBbV2luXSBOdWxsIHBvaW50ZXIgY3Jhc2guCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJr
aXQub3JnL3Nob3dfYnVnLmNnaT9pZD0xNDk5NTcKKworICAgICAgICBSZXZpZXdlZCBieSBOT0JP
RFkgKE9PUFMhKS4KKworICAgICAgICBDaGVjayBpZiBKU0NlbGwgc3RydWN0dXJlIElEIGlzIHZh
bGlkLgorCisgICAgICAgICogYnl0ZWNvZGUvU3BlY3VsYXRlZFR5cGUuY3BwOgorICAgICAgICAo
SlNDOjpzcGVjdWxhdGlvbkZyb21DZWxsKToKKwogMjAxNS0xMC0wOSAgWGFiaWVyIFJvZHJpZ3Vl
eiBDYWx2YXIgIDxjYWx2YXJpc0BpZ2FsaWEuY29tPiBhbmQgWW91ZW5uIEZhYmxldCAgPHlvdWVu
bi5mYWJsZXRAY3JmLmNhbm9uLmZyPgogCiAgICAgICAgIEF1dG9tYXRlIFdlYkNvcmUgSlMgYnVp
bHRpbnMgZ2VuZXJhdGlvbiBhbmQgYnVpbGQgc3lzdGVtCkluZGV4OiBTb3VyY2UvSmF2YVNjcmlw
dENvcmUvYnl0ZWNvZGUvU3BlY3VsYXRlZFR5cGUuY3BwCj09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFNvdXJjZS9K
YXZhU2NyaXB0Q29yZS9ieXRlY29kZS9TcGVjdWxhdGVkVHlwZS5jcHAJKHJldmlzaW9uIDE5MDc4
MikKKysrIFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9ieXRlY29kZS9TcGVjdWxhdGVkVHlwZS5jcHAJ
KHdvcmtpbmcgY29weSkKQEAgLTM2MCw2ICszNjAsOSBAQCBTcGVjdWxhdGVkVHlwZSBzcGVjdWxh
dGlvbkZyb21TdHJ1Y3R1cmUoCiAKIFNwZWN1bGF0ZWRUeXBlIHNwZWN1bGF0aW9uRnJvbUNlbGwo
SlNDZWxsKiBjZWxsKQogeworICAgIGlmICghY2VsbC0+c3RydWN0dXJlSUQoKSkKKyAgICAgICAg
cmV0dXJuIFNwZWNOb25lOworCiAgICAgaWYgKEpTU3RyaW5nKiBzdHJpbmcgPSBqc0R5bmFtaWND
YXN0PEpTU3RyaW5nKj4oY2VsbCkpIHsKICAgICAgICAgaWYgKGNvbnN0IFN0cmluZ0ltcGwqIGlt
cGwgPSBzdHJpbmctPnRyeUdldFZhbHVlSW1wbCgpKSB7CiAgICAgICAgICAgICBpZiAoaW1wbC0+
aXNBdG9taWMoKSkK
</data>
<flag name="review"
          id="287962"
          type_id="1"
          status="-"
          setter="ggaren"
    />
          </attachment>
      

    </bug>

</bugzilla>