<?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>265927</bug_id>
          
          <creation_ts>2023-12-05 21:24:47 -0800</creation_ts>
          <short_desc>Crash in JSC::Wasm::SectionParser::parseTableHelper (     this=this@entry=0x7fffffffdae0, isImport=144)     at /home/WebKit/Source/JavaScriptCore/wasm/WasmSectionParser.cpp:329</short_desc>
          <delta_ts>2024-01-30 11:31:45 -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>WebAssembly</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>247394</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter>xiangwei1895</reporter>
          <assigned_to name="Asumu Takikawa">asumu</assigned_to>
          <cc>asumu</cc>
    
    <cc>justin_michaud</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1997310</commentid>
    <comment_count>0</comment_count>
    <who name="">xiangwei1895</who>
    <bug_when>2023-12-05 21:24:47 -0800</bug_when>
    <thetext>## JavaScriptCore Version
4425cc9b8d966cab3215732b6ae7449d51c713eb

## Build 
Ubuntu 20.04.2 LTS (Linux 5.15.0-67-generic x86_64)
./Tools/Scripts/build-jsc --jsc-only --debug --build-dir=asan --cmakeargs=&quot;-DCMAKE_C_COMPILER=&apos;/usr/bin/clang&apos; -DCMAKE_CXX_COMPILER=&apos;/usr/bin/clang++&apos; -DCMAKE_CXX_FLAGS=&apos;-g -O3 -fsanitize=address&apos;&quot;

## Testcase and  Execution steps

```
var wasm_code = new Uint8Array([0,97,115,109,1,0,0,0,1,150,128,128,128,0,4,80,0,95,0,80,0,94,127,1,80,0,96,3,127,127,127,1,127,96,0,0,3,130,128,128,128,0,1,2,4,150,128,128,128,0,2,64,0,112,1,1,25,208,112,11,64,0,107,106,1,0,0,65,0,251,32,11,5,132,128,128,128,0,1,1,16,32,13,133,128,128,128,0,2,0,3,0,3,7,136,128,128,128,0,1,4,109,97,105,110,0,0,9,139,128,128,128,0,1,6,0,65,0,11,112,1,210,0,11,10,138,128,128,128,0,1,8,0,65,203,144,170,207,1,11]);
var wasm_module = new WebAssembly.Module(wasm_code);
var wasm_instance = new WebAssembly.Instance(wasm_module);
var f = wasm_instance.exports.main;
f();

```
./bin/jsc  --useWebAssemblyGC=true --useWebAssemblyTypedFunctionReferences=true  testcase.js

## Output
Aborted (core dumped)

## Backtrace
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737258203072)
    at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=140737258203072)
    at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=140737258203072, signo=signo@entry=6)
    at ./nptl/pthread_kill.c:89
#3  0x00007ffff24c9476 in __GI_raise (sig=sig@entry=6)
    at ../sysdeps/posix/raise.c:26
#4  0x00007ffff24af7f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff51b32ea in WTFCrashWithInfo ()
    at WTF/Headers/wtf/Assertions.h:778
#6  0x00007ffff7769fa2 in JSC::Wasm::SectionParser::parseTableHelper (
    this=this@entry=0x7fffffffdae0, isImport=144)
    at /home/WebKit/Source/JavaScriptCore/wasm/WasmSectionParser.cpp:329
#7  0x00007ffff776ec1d in JSC::Wasm::SectionParser::parseTable (
    this=0x7fffffffdae0)
    at /home/WebKit/Source/JavaScriptCore/wasm/WasmSectionParser.cpp:345
#8  0x00007ffff77a1cc5 in JSC::Wasm::StreamingParser::parseSectionPayload (
    this=this@entry=0x7fffe8061480, data=...)
    at /home/WebKit/Source/JavaScriptCore/wasm/WasmStreamingParser.cpp:197
#9  0x00007ffff77a2f80 in JSC::Wasm::StreamingParser::addBytes (
    this=0x7fffe8061480, bytes=0x7fffe800b1a0 &quot;&quot;, bytesSize=140, 
    isEndOfStream=&lt;optimized out&gt;)
--Type &lt;RET&gt; for more, q to quit, c to continue without paging--
   smStreamingParser.cpp:342
#10 0x00007ffff7516f43 in JSC::Wasm::StreamingParser::addBytes (this=0x7fffe8061480, bytes=0x7fffe800b1a0 &quot;&quot;, length=140) at /home/WebKit/Source/JavaScriptCore/wasm/WasmStreamingParser.h:81
#11 JSC::Wasm::EntryPlan::parseAndValidateModule (this=0x7fffe8061400, source=0x7fffe800b1a0 &quot;&quot;, sourceLength=140) at /home/WebKit/Source/JavaScriptCore/wasm/WasmEntryPlan.cpp:91
#12 0x00007ffff764e3fa in JSC::Wasm::LLIntPlan::LLIntPlan(JSC::VM&amp;, WTF::Vector&lt;unsigned char, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;&amp;&amp;, JSC::Wasm::CompilerMode, WTF::RefPtr&lt;WTF::SharedTask&lt;void (JSC::Wasm::Plan&amp;)&gt;, WTF::RawPtrTraits&lt;WTF::SharedTask&lt;void (JSC::Wasm::Plan&amp;)&gt; &gt;, WTF::DefaultRefDerefTraits&lt;WTF::SharedTask&lt;void (JSC::Wasm::Plan&amp;)&gt; &gt; &gt;&amp;&amp;) (this=0x7fffe8061400, vm=..., 
    source=..., compilerMode=&lt;optimized out&gt;, task=...) at /home/WebKit/Source/JavaScriptCore/wasm/WasmLLIntPlan.cpp:49

#13 0x00007ffff76597ee in JSC::Wasm::Module::validateSync (vm=..., source=...) at /home/WebKit/Source/JavaScriptCore/wasm/WasmModule.cpp:98</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1997478</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-12-06 12:54:31 -0800</bug_when>
    <thetext>&lt;rdar://problem/119270769&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2008050</commentid>
    <comment_count>2</comment_count>
    <who name="Asumu Takikawa">asumu</who>
    <bug_when>2024-01-26 15:28:05 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/23331</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2009038</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-01-30 11:31:37 -0800</bug_when>
    <thetext>Committed 273774@main (8d40b312efa8): &lt;https://commits.webkit.org/273774@main&gt;

Reviewed commits have been landed. Closing PR #23331 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>