swiftwasm / swiftwasm/JavaScriptKit

Memory corruption take 2

Open
#461 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
986
Forks
76
Avg merge
21h 11m
Merged PRs (30d)
4

Description

I still see the following crash if I re-enable the Examples/Testing tests.

https://github.com/swiftwasm/JavaScriptKit/blob/84243a4c66d47e17c540bbdc17ef49f191840a07/Plugins/PackageToJS/Tests/ExampleTests.swift#L249-L250


   RuntimeError: memory access out of bounds
       at CounterPackageTests.xctest.dlmalloc (wasm://wasm/CounterPackageTests.xctest-0f40d596:wasm-function[89702]:0x115e7de)
       at CounterPackageTests.xctest.malloc (wasm://wasm/CounterPackageTests.xctest-0f40d596:wasm-function[89701]:0x115e22a)
       at CounterPackageTests.xctest.swift::Demangle::__runtime::Demangler::demangleBoundGenerics(swift::Demangle::__runtime::Vector<swift::Demangle::__runtime::Node*>&, swift::Demangle::__runtime::Node*&) (wasm://wasm/CounterPackageTests.xctest-0f40d596:wasm-function[28248]:0x522adc)
       at CounterPackageTests.xctest.swift::Demangle::__runtime::Demangler::demangleBoundGenericType() (wasm://wasm/CounterPackageTests.xctest-0f40d596:wasm-function[28200]:0x512379)
       at CounterPackageTests.xctest.swift::Demangle::__runtime::Demangler::demangleOperator() (wasm://wasm/CounterPackageTests.xctest-0f40d596:wasm-function[28174]:0x50e156)
       at CounterPackageTests.xctest.swift::Demangle::__runtime::Demangler::demangleType(__swift::__runtime::llvm::StringRef, std::__2::function<swift::Demangle::__runtime::Node* (swift::Demangle::__runtime::SymbolicReferenceKind, swift::Demangle::__runtime::Directness, int, void const*)>) (wasm://wasm/CounterP
ackageTests.xctest-0f40d596:wasm-function[28172]:0x50db25)
       at CounterPackageTests.xctest.swift_getTypeByMangledName (wasm://wasm/CounterPackageTests.xctest-0f40d596:wasm-function[27912]:0x4ee2ad)
       at CounterPackageTests.xctest.(anonymous namespace)::DecodedMetadataBuilder::resolveOpaqueType(swift::Demangle::__runtime::Node*, __swift::__runtime::llvm::ArrayRef<__swift::__runtime::llvm::ArrayRef<swift::MetadataPackOrValue>>, unsigned int) (wasm://wasm/CounterPackageTests.xctest-0f40d596:wasm-functio
n[27992]:0x500764)
       at CounterPackageTests.xctest.swift::Demangle::__runtime::TypeDecoder<(anonymous namespace)::DecodedMetadataBuilder>::decodeMangledType(swift::Demangle::__runtime::Node*, unsigned int, bool) (wasm://wasm/CounterPackageTests.xctest-0f40d596:wasm-function[27925]:0x4f3cfe)
       at CounterPackageTests.xctest.swift::Demangle::__runtime::TypeDecoder<(anonymous namespace)::DecodedMetadataBuilder>::decodeGenericArgs(swift::Demangle::__runtime::Node*, unsigned int, __swift::__runtime::llvm::SmallVectorImpl<swift::MetadataPackOrValue>&) (wasm://wasm/CounterPackageTests.xctest-0f40d596
:wasm-function[27971]:0x4fc426)

Toolchain version: DEVELOPMENT-SNAPSHOT-2025-10-02-a

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Examples/Testing and the referenced lines 249-250 in ExampleTests.swift, then reproduce the crash using the DEVELOPMENT-SNAPSHOT-2025-10-02-a toolchain. Trace the reported memory access failure through the test run; done means the re-enabled tests complete without the out-of-bounds crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift, wasm
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.