<?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>222542</bug_id>
          
          <creation_ts>2021-03-01 04:10:01 -0800</creation_ts>
          <short_desc>Crash calling the &quot;load&quot; function on a too large file in the jsc command line tool</short_desc>
          <delta_ts>2022-01-31 08:38:52 -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>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Critical</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Xiaoyu He">1422930734</reporter>
          <assigned_to name="Yusuke Suzuki">ysuzuki</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>darin</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1734373</commentid>
    <comment_count>0</comment_count>
      <attachid>421808</attachid>
    <who name="Xiaoyu He">1422930734</who>
    <bug_when>2021-03-01 04:10:01 -0800</bug_when>
    <thetext>Created attachment 421808
poc

0x7ffff4681fab &lt;raise+187&gt;      mov    edi, 0x2
   0x7ffff4681fb0 &lt;raise+192&gt;      mov    eax, 0xe
   0x7ffff4681fb5 &lt;raise+197&gt;      syscall 
 → 0x7ffff4681fb7 &lt;raise+199&gt;      mov    rcx, QWORD PTR [rsp+0x108]
   0x7ffff4681fbf &lt;raise+207&gt;      xor    rcx, QWORD PTR fs:0x28
   0x7ffff4681fc8 &lt;raise+216&gt;      mov    eax, r8d
   0x7ffff4681fcb &lt;raise+219&gt;      jne    0x7ffff4681fec &lt;__GI_raise+252&gt;
   0x7ffff4681fcd &lt;raise+221&gt;      add    rsp, 0x118
   0x7ffff4681fd4 &lt;raise+228&gt;      ret    
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── threads ────
[#0] Id 1, Name: &quot;jsc_afl_asan18&quot;, stopped, reason: SIGABRT
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── trace ────
[#0] 0x7ffff4681fb7 → __GI_raise(sig=0x6)
[#1] 0x7ffff4683921 → __GI_abort()
[#2] 0x59c516 → allocateBuffer&lt;WTF::FailureAction::Crash&gt;()
[#3] 0x5ef736 → reserveCapacity&lt;WTF::FailureAction::Crash&gt;()
[#4] 0x5ef3e3 → expandCapacity&lt;WTF::FailureAction::Crash&gt;()
[#5] 0x5eec66 → resize()
[#6] 0x5851ab → fillBufferWithContentsOfFile&lt;WTF::Vector&lt;char, 0, WTF::CrashOnOverflow, 16, WTF::FastMalloc&gt; &gt;()
[#7] 0x5851ab → fillBufferWithContentsOfFile()
[#8] 0x5851ab → fetchScriptFromLocalFileSystem()
[#9] 0x54378d → functionLoad()</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1734374</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-03-01 04:10:14 -0800</bug_when>
    <thetext>&lt;rdar://problem/74863969&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1734472</commentid>
    <comment_count>2</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2021-03-01 09:54:52 -0800</bug_when>
    <thetext>This intentional crash is a policy of the &quot;jsc&quot; command line tool, not of JavaScriptCore itself. Could easily be changed, but is not a JavaScriptCore security bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1734474</commentid>
    <comment_count>3</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2021-03-01 09:55:32 -0800</bug_when>
    <thetext>Trivial to fix by adding a tryReserveCapacity call to the fillBufferWithContentsOfFile function.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1734686</commentid>
    <comment_count>4</comment_count>
    <who name="Xiaoyu He">1422930734</who>
    <bug_when>2021-03-01 16:47:11 -0800</bug_when>
    <thetext>Can you give me a CVE number?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1734721</commentid>
    <comment_count>5</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2021-03-01 18:26:14 -0800</bug_when>
    <thetext>I don’t think this is a security bug since it’s specific to the &quot;jsc&quot; command line tool. It interferes with fuzzing, but has no effect on security of web browsers using JavaScriptCore, for example.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1740395</commentid>
    <comment_count>6</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2021-03-16 23:06:48 -0700</bug_when>
    <thetext>Yes. This is not a security issue since it always crashes and it only exists in JSC shell (this is not included in WebContent process).</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>421808</attachid>
            <date>2021-03-01 04:10:01 -0800</date>
            <delta_ts>2021-03-01 04:10:01 -0800</delta_ts>
            <desc>poc</desc>
            <filename>crash_jsc_0</filename>
            <type>text/plain</type>
            <size>332</size>
            <attacher name="Xiaoyu He">1422930734</attacher>
            
              <data encoding="base64">bG9hZCgnJyk7CmxvYWQoJycpOwpjb25zdCBidWlsZGVyID0gbmV3IFdhc21Nb2R1bGVCdWlsZGVy
KCk7CmJ1aWxkZXIuYWRkTWVtb3J5KDE2LCAzMik7CmJ1aWxkZXIuYWRkRnVuY3Rpb24oJyh7fSkn
LCBrU2lnX2lfdikuYWRkQm9keShbCiAgICBrRXhwckkzMkNvbnN0LAogICAgMTIKXSk7CmxldCBi
bGEgPSA3MTg7CmxldCBtb2R1bGUgPSBuZXcgV2ViQXNzZW1ibHkuTW9kdWxlKGJ1aWxkZXIudG9C
dWZmZXIoKSk7Cm1vZHVsZS50aGVuID0gcmVzb2x2ZSA9PiB7CiAgICByZXR1cm4gcmVzb2x2ZSgx
MDk0Nzk1NTg1KTsKfTsKV2ViQXNzZW1ibHkuaW5zdGFudGlhdGUobW9kdWxlKTs=
</data>

          </attachment>
      

    </bug>

</bugzilla>