<?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>299393</bug_id>
          
          <creation_ts>2025-09-23 14:34:19 -0700</creation_ts>
          <short_desc>Wasm validator disallows name imports longer than 100_000 bytes</short_desc>
          <delta_ts>2025-10-02 13:57:15 -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>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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Martin Kustermann">kustermann.martin</reporter>
          <assigned_to name="Shu-yu Guo">syg</assigned_to>
          <cc>syg</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2145345</commentid>
    <comment_count>0</comment_count>
    <who name="Martin Kustermann">kustermann.martin</who>
    <bug_when>2025-09-23 14:34:19 -0700</bug_when>
    <thetext>We have a dart2wasm compiler and noticed on some programs that JSC (command line shell) results in a validation error. The root cause of it is that it refuses import names longer than 100_000 bytes.

Normally imported names are surely short.

Though the recent js-string-builtin wasm spec enables a magic import mechanism where one can import JS strings via specially recognized imports. (Although JSC may(?) not support js-string-builtins yet, it can be polyfilled on the JS side)

String constants in Dart applications can exceed 100_000 bytes and cause a wasm validation error. The root cause is due to using of the constant in [0] when decoding import names.

[0] https://github.com/WebKit/WebKit/blob/68dbd317f3d24b03f06a82b11fddd2bb6e7a33b5/Source/JavaScriptCore/wasm/WasmLimits.h#L54

Expected results:

Looking through the core wasm spec and js-wasm spec (https://webassembly.github.io/spec/js-api/index.html#limits) it&apos;s unclear where this 100_000 byte limit comes from.

Can it be that this is not specified?

D8/Chrome doesn&apos;t have this issue: It loads &amp; runs such modules just fine.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2147293</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-09-30 14:35:56 -0700</bug_when>
    <thetext>&lt;rdar://problem/161683448&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2147294</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-09-30 14:35:56 -0700</bug_when>
    <thetext>&lt;rdar://problem/161683389&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2147861</commentid>
    <comment_count>3</comment_count>
    <who name="Shu-yu Guo">syg</who>
    <bug_when>2025-10-02 10:03:59 -0700</bug_when>
    <thetext>Going by the git blame it seems like these limits were copied from V8 for compat reasons during the early days of Wasm. Indeed the constant still exists in V8 [1] but it seems like it was never (?) used. We&apos;ll investigate removing this limit.

[1] https://source.chromium.org/chromium/chromium/src/+/main:v8/src/wasm/wasm-limits.h;l=49;drc=d78d6f646dee0f68dcc59eed2d7de0f910e2fe2a</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2147874</commentid>
    <comment_count>4</comment_count>
    <who name="Shu-yu Guo">syg</who>
    <bug_when>2025-10-02 10:50:06 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/51687</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2147930</commentid>
    <comment_count>5</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-10-02 13:57:13 -0700</bug_when>
    <thetext>Committed 300897@main (81ff731cd920): &lt;https://commits.webkit.org/300897@main&gt;

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

    </bug>

</bugzilla>