<?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>258804</bug_id>
          
          <creation_ts>2023-07-03 04:42:47 -0700</creation_ts>
          <short_desc>segmentation fault in Source/JavaScriptCore/wasm/WasmTypeDefinition.h:671</short_desc>
          <delta_ts>2024-01-30 16:38:51 -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>d_degazio</cc>
    
    <cc>justin_michaud</cc>
    
    <cc>mark.lam</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1964769</commentid>
    <comment_count>0</comment_count>
    <who name="">xiangwei1895</who>
    <bug_when>2023-07-03 04:42:47 -0700</bug_when>
    <thetext>## JavaScriptCore Version
1f2d2a92eeb831bedd01bbb5b694a0e29fa9af81

## Build 
Ubuntu 20.04.2 LTS (Linux 5.15.0-67-generic x86_64)
./Tools/Scripts/build-jsc --jsc-only --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 buffer = new Uint8Array([0,97,115,109,1,0,0,0,1,157,128,128,128,0,5,80,0,95,0,80,1,0,95,0,80,0,94,127,1,80,0,96,3,127,127,127,1,127,96,1,108,1,0,3,130,128,128,128,0,1,3,4,133,128,128,128,0,1,112,1,1,1,5,132,128,128,128,0,1,1,16,32,13,131,128,128,128,0,1,0,4,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,150,128,128,128,0,1,20,0,2,108,1,2,108,1,208,1,11,11,8,0,65,152,222,141,210,120,11]);
var module = new WebAssembly.Module(buffer);
```
./bin/jsc  --useWebAssemblyGC=true --useWebAssemblyTypedFunctionReferences=true testcase.js

## Output
Segmentation fault

## Backtrace
AddressSanitizer:DEADLYSIGNAL
=================================================================
==3175520==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 (pc 0x7f1e14f33243 bp 0x7f1dbfbe3550 sp 0x7f1dbfbe3430 T9)
==3175520==The signal is caused by a READ memory access.
==3175520==Hint: address points to the zero page.
    #0 0x7f1e14f33243 in JSC::Wasm::RTT::displaySize() const /home/WebKit/Source/JavaScriptCore/wasm/WasmTypeDefinition.h:671:47
    #1 0x7f1e14f33243 in JSC::Wasm::RTT::isSubRTT(JSC::Wasm::RTT const&amp;) const /home/WebKit/Source/JavaScriptCore/wasm/WasmTypeDefinition.cpp:544:20
    #2 0x7f1e1460a9aa in JSC::Wasm::isSubtypeIndex(unsigned long, unsigned long) /home/WebKit/Source/JavaScriptCore/wasm/WasmFormat.h:279:28
    #3 0x7f1e14d9e081 in JSC::Wasm::FunctionParser&lt;JSC::Wasm::LLIntGenerator&gt;::unify(JSC::Wasm::LLIntGenerator::ControlType const&amp;) /home/WebKit/Source/JavaScriptCore/wasm/WasmFunctionParser.h:1471:9
    #4 0x7f1e14d3f2c2 in JSC::Wasm::FunctionParser&lt;JSC::Wasm::LLIntGenerator&gt;::parseExpression() /home/WebKit/Source/JavaScriptCore/wasm/WasmFunctionParser.h:2918:9
    #5 0x7f1e14d1ad59 in JSC::Wasm::FunctionParser&lt;JSC::Wasm::LLIntGenerator&gt;::parseBody() /home/WebKit/Source/JavaScriptCore/wasm/WasmFunctionParser.h:365:13
    #6 0x7f1e14cfe8d6 in JSC::Wasm::FunctionParser&lt;JSC::Wasm::LLIntGenerator&gt;::parse() /home/WebKit/Source/JavaScriptCore/wasm/WasmFunctionParser.h:336:5
    #7 0x7f1e14cb7390 in JSC::Wasm::parseAndCompileBytecode(unsigned char const*, unsigned long, JSC::Wasm::TypeDefinition const&amp;, JSC::Wasm::ModuleInformation&amp;, unsigned int) /home/WebKit/Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp:580:5
    #8 0x7f1e14cf2601 in JSC::Wasm::LLIntPlan::compileFunction(unsigned int) /home/WebKit/Source/JavaScriptCore/wasm/WasmLLIntPlan.cpp:89:91
    #9 0x7f1e14ca8473 in JSC::Wasm::EntryPlan::compileFunctions(JSC::Wasm::Plan::CompilationEffort) /home/WebKit/Source/JavaScriptCore/wasm/WasmEntryPlan.cpp:218:9
    #10 0x7f1e14f5c6a7 in JSC::Wasm::Worklist::Thread::work() /home/WebKit/Source/JavaScriptCore/wasm/WasmWorklist.cpp:111:15
    #11 0x7f1e154ed99a in WTF::AutomaticThread::start(WTF::AbstractLocker const&amp;)::$_0::operator()() const /home/WebKit/Source/WTF/wtf/AutomaticThread.cpp:229:37
    #12 0x7f1e154ed99a in WTF::Detail::CallableWrapper&lt;WTF::AutomaticThread::start(WTF::AbstractLocker const&amp;)::$_0, void&gt;::call() /home/WebKit/Source/WTF/wtf/Function.h:53:39
    #13 0x7f1e155951ef in WTF::Function&lt;void ()&gt;::operator()() const /home/WebKit/Source/WTF/wtf/Function.h:82:35
    #14 0x7f1e155951ef in WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) /home/WebKit/Source/WTF/wtf/Threading.cpp:250:5
    #15 0x7f1e1571ba65 in WTF::wtfThreadEntryPoint(void*) /home/WebKit/Source/WTF/wtf/posix/ThreadingPOSIX.cpp:242:5
    #16 0x7f1e0d785b42 in start_thread nptl/./nptl/pthread_create.c:442:8
    #17 0x7f1e0d8179ff  misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1965915</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-07-10 04:43:17 -0700</bug_when>
    <thetext>&lt;rdar://problem/112010224&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2008675</commentid>
    <comment_count>2</comment_count>
    <who name="Asumu Takikawa">asumu</who>
    <bug_when>2024-01-29 15:05:06 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/23467</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2009152</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-01-30 16:38:49 -0800</bug_when>
    <thetext>Committed 273795@main (cb06d55fdea9): &lt;https://commits.webkit.org/273795@main&gt;

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

    </bug>

</bugzilla>