Skip to content

[web][skwasm] memory access out of bounds in paragraphBuilder_dispose during heavy widget rebuilds #184858

Closed

Description

@tarunshri

Steps to reproduce

Steps to reproduce:

Create app with this code
flutter build web --wasm --release
Serve build/web/ without COEP/COOP headers
Open in Chrome 146
Drag items up and down rapidly for 10-20 seconds

Expected results

Items reorder smoothly, same as canvaskit.

Actual results

App freezes. Console shows:Uncaught RuntimeError: memory access out of bounds
at $paragraphBuilder_dispose (skwasm.wasm:0x262225)

Uncaught RuntimeError: memory access out of bounds
at $textStyle_dispose (skwasm.wasm:0x1fbe17)

Code sample

Code sample
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) => MaterialApp(home: const DragTest());
}

class DragTest extends StatefulWidget {
  const DragTest({super.key});
  @override
  State<DragTest> createState() => _DragTestState();
}

class _DragTestState extends State<DragTest> {
  final items = List.generate(50, (i) => 'Item $i');

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Skwasm Drag Crash')),
      body: ReorderableListView.builder(
        itemCount: items.length,
        itemBuilder: (context, index) => ListTile(
          key: ValueKey(items[index]),
          title: Text(items[index]),
          subtitle: Text('Subtitle #$index',
              style: const TextStyle(fontStyle: FontStyle.italic)),
          leading: const Icon(Icons.drag_handle),
        ),
        onReorder: (old, next) {
          setState(() {
            if (next > old) next--;
            items.insert(next, items.removeAt(old));
          });
        },
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs

Logs
at skwasm.wasm:0x3c7ef
at skwasm.wasm:0x1fbc43
at main.dart.wasm:0x50734a
at main.dart.wasm:0x505fac
at main.dart.wasm:0x5064b3
at main.dart.wasm:0x4a8ec2Understand this error
skwasm.wasm:0xfd4a Uncaught RuntimeError: memory access out of bounds
at skwasm.wasm:0xfd4a
at skwasm.wasm:0x136622
at skwasm.wasm:0xb982
at skwasm.wasm:0x262006
at main.dart.wasm:0x5049bf
at main.dart.wasm:0x535ae9
at main.dart.wasm:0x53594e
at main.dart.wasm:0xc83e75
at main.dart.wasm:0xc8ac66
at main.dart.wasm:0x53aa6dUnderstand this error
skwasm.wasm:0xedc7 Uncaught RuntimeError: memory access out of bounds
at skwasm.wasm:0xedc7
at skwasm.wasm:0x161ff
at skwasm.wasm:0x14818c
at skwasm.wasm:0x102f0
at skwasm.wasm:0xb7e5f
at skwasm.wasm:0x1af0a
at skwasm.wasm:0xb9776
at skwasm.wasm:0x2782ec
at main.dart.wasm:0x1038ba1
at main.dart.wasm:0x1038bb8Understand this error
skwasm.wasm:0xb8b3 Uncaught RuntimeError: memory access out of bounds
at skwasm.wasm:0xb8b3
at skwasm.wasm:0x21dcbc
at skwasm.wasm:0x1ee228
at skwasm.wasm:0x262225
at main.dart.wasm:0x507399
at main.dart.wasm:0x5073b8
at main.dart.wasm:0x4a910d
at main.dart.wasm:0x4a91a1
at main.dart.wasm:0x48daba
at main.dart.mjs:103:81
$func221 @ skwasm.wasm:0xb8b3
$func9130 @ skwasm.wasm:0x21dcbc
$func8118 @ skwasm.wasm:0x1ee228
$paragraphBuilder_dispose @ skwasm.wasm:0x262225
$func6933 @ main.dart.wasm:0x507399
$func6935 @ main.dart.wasm:0x5073b8
$func2924 @ main.dart.wasm:0x4a910d
$func2929 @ main.dart.wasm:0x4a91a1
$_1663 @ main.dart.wasm:0x48daba
(anonymous) @ main.dart.mjs:103Understand this error
skwasm.wasm:0xb8b3 Uncaught RuntimeError: memory access out of bounds
at skwasm.wasm:0xb8b3
at skwasm.wasm:0x1fbe17
at main.dart.wasm:0x4a90c6
at main.dart.wasm:0x4a912b
at main.dart.wasm:0x4a910d
at main.dart.wasm:0x4a91a1
at main.dart.wasm:0x48daba
at main.dart.mjs:103:81
$func221 @ skwasm.wasm:0xb8b3
$textStyle_dispose @ skwasm.wasm:0x1fbe17
$func2923 @ main.dart.wasm:0x4a90c6
$func2926 @ main.dart.wasm:0x4a912b
$func2924 @ main.dart.wasm:0x4a910d
$func2929 @ main.dart.wasm:0x4a91a1
$_1663 @ main.dart.wasm:0x48daba
(anonymous) @ main.dart.mjs:103Understand this error
main.dart.mjs:73 💓 Sending ping...
main.dart.mjs:73 ⚠️ Pong timeout - missed pongs: 1/3
main.dart.mjs:73 💓 Sending ping...
main.dart.mjs:73 ⚠️ Pong timeout - missed pongs: 2/3
main.dart.mjs:73 💓 Sending ping...
main.dart.mjs:73 ⚠️ Pong timeout - missed pongs: 3/3
main.dart.mjs:73 🔴 Max missed pongs reached - connection considered lost
main.dart.mjs:73 📊 Socket state: reconnecting
main.dart.mjs:73 🔄 Reconnect attempt 1/10 in 1s
main.dart.mjs:73 🧹 Cleaning up socket...
main.dart.mjs:73 📱 App resumed
main.dart.mjs:73 ⚠️ Socket unhealthy - health monitor will handle recovery
main.dart.mjs:73 🔍 Forcing health check...
main.dart.mjs:73 ⚠️ Health check failed - triggering reconnect
main.dart.mjs:73 ⚠️ Reconnection already in progress - skipping
main.dart.wasm:0x477ce0 Uncaught Exception {}
$func1078 @ main.dart.wasm:0x477ce0
$func1074 @ main.dart.wasm:0x477c88
$func8677 @ main.dart.wasm:0x533783
$func9067 @ main.dart.wasm:0x54078e
$func8988 @ main.dart.wasm:0x53ef64
$func8977 @ main.dart.wasm:0x53eb77
$func8972 @ main.dart.wasm:0x53e971
$func9070 @ main.dart.wasm:0x54085c
$func8969 @ main.dart.wasm:0x53e623
$func97856 @ main.dart.wasm:0x1059de0
$func97852 @ main.dart.wasm:0x1059d0d
$func97854 @ main.dart.wasm:0x1059d43
$func2252 @ main.dart.wasm:0x496771
$func2251 @ main.dart.wasm:0x49673e
$func2247 @ main.dart.wasm:0x4966dd
$func2253 @ main.dart.wasm:0x4967b0
$func2255 @ main.dart.wasm:0x4967d5
$func1433 @ main.dart.wasm:0x4889ab
$func1845 @ main.dart.wasm:0x48fa57
$func1847 @ main.dart.wasm:0x48fa74
$_1199 @ main.dart.wasm:0x48d61a
(anonymous) @ main.dart.mjs:212Understand this error
main.dart.mjs:73 📱 App inactive
main.dart.mjs:73 📱 App resumed
main.dart.mjs:73 ⏭️ Socket health check already in progress
main.dart.wasm:0x477ce0 Uncaught Exception {}
$func1078 @ main.dart.wasm:0x477ce0
$func1074 @ main.dart.wasm:0x477c88
$func8677 @ main.dart.wasm:0x533783
$func9067 @ main.dart.wasm:0x54078e
$func8988 @ main.dart.wasm:0x53ef64
$func8977 @ main.dart.wasm:0x53eb77
$func8972 @ main.dart.wasm:0x53e971
$func9070 @ main.dart.wasm:0x54085c
$func8970 @ main.dart.wasm:0x53e62f
$func97856 @ main.dart.wasm:0x1059df1
$func97852 @ main.dart.wasm:0x1059d0d
$func97854 @ main.dart.wasm:0x1059d43
$func2252 @ main.dart.wasm:0x496771
$func2251 @ main.dart.wasm:0x49673e
$func2247 @ main.dart.wasm:0x4966dd
$func2253 @ main.dart.wasm:0x4967b0
$func2255 @ main.dart.wasm:0x4967d5
$func1433 @ main.dart.wasm:0x4889ab
$func1845 @ main.dart.wasm:0x48fa57
$func1847 @ main.dart.wasm:0x48fa74
$_1199 @ main.dart.wasm:0x48d61a
(anonymous) @ main.dart.mjs:212Understand this error
main.dart.mjs:73 📱 App inactive
main.dart.mjs:73 📱 App hidden
main.dart.mjs:73 📱 App inactive
main.dart.mjs:73 📱 App resumed
main.dart.mjs:73 ⏭️ Socket health check already in progress
main.dart.wasm:0x477ce0 Uncaught Exception {}
$func1078 @ main.dart.wasm:0x477ce0
$func1074 @ main.dart.wasm:0x477c88
$func8677 @ main.dart.wasm:0x533783
$func9067 @ main.dart.wasm:0x54078e
$func8988 @ main.dart.wasm:0x53ef64
$func8977 @ main.dart.wasm:0x53eb77
$func8972 @ main.dart.wasm:0x53e971
$func9070 @ main.dart.wasm:0x54085c
$func8970 @ main.dart.wasm:0x53e62f
$func97856 @ main.dart.wasm:0x1059df1
$func97852 @ main.dart.wasm:0x1059d0d
$func97854 @ main.dart.wasm:0x1059d43
$func2252 @ main.dart.wasm:0x496771
$func2251 @ main.dart.wasm:0x49673e
$func2247 @ main.dart.wasm:0x4966dd
$func2253 @ main.dart.wasm:0x4967b0
$func2255 @ main.dart.wasm:0x4967d5
$func1433 @ main.dart.wasm:0x4889ab
$func1845 @ main.dart.wasm:0x48fa57
$func1847 @ main.dart.wasm:0x48fa74
$_1199 @ main.dart.wasm:0x48d61a
(anonymous) @ main.dart.mjs:212Understand this error
main.dart.mjs:73 📱 App inactive
main.dart.mjs:73 📱 App resumed
main.dart.mjs:73 ⏭️ Socket health check already in progress
main.dart.wasm:0x477ce0 Uncaught Exception {}
$func1078 @ main.dart.wasm:0x477ce0
$func1074 @ main.dart.wasm:0x477c88
$func8677 @ main.dart.wasm:0x533783
$func9067 @ main.dart.wasm:0x54078e
$func8988 @ main.dart.wasm:0x53ef64
$func8977 @ main.dart.wasm:0x53eb77
$func8972 @ main.dart.wasm:0x53e971
$func9070 @ main.dart.wasm:0x54085c
$func8969 @ main.dart.wasm:0x53e623
$func97856 @ main.dart.wasm:0x1059de0
$func97852 @ main.dart.wasm:0x1059d0d
$func97854 @ main.dart.wasm:0x1059d43
$func2252 @ main.dart.wasm:0x496771
$func2251 @ main.dart.wasm:0x49673e
$func2247 @ main.dart.wasm:0x4966dd
$func2253 @ main.dart.wasm:0x4967b0
$func2255 @ main.dart.wasm:0x4967d5
$func1433 @ main.dart.wasm:0x4889ab
$func1845 @ main.dart.wasm:0x48fa57
$func1847 @ main.dart.wasm:0x48fa74
$_1199 @ main.dart.wasm:0x48d61a
(anonymous) @ main.dart.mjs:212Understand this error
main.dart.mjs:73 📱 App inactive
main.dart.mjs:73 📱 App hidden
main.dart.mjs:73 📱 App inactive
main.dart.mjs:73 📱 App resumed
main.dart.mjs:73 ⏭️ Socket health check already in progress

Flutter Doctor output

Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.41.2, on macOS 26.3.1 25D771280a darwin-arm64, locale en) [1,740ms]
• Flutter version 3.41.2 on channel stable at /Users/Tarun/fvm/versions/3.41.2
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 90673a4 (7 weeks ago), 2026-02-18 13:54:59 -0800
• Engine revision 6c0baae
• Dart version 3.11.0
• DevTools version 2.54.1
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets,
omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [8.1s]
• Android SDK at /Users/Tarun/Library/Android/sdk
• Emulator version 31.3.13.0 (build_id 9189900) (CL:N/A)
✗ Flutter requires Android SDK 36 and the Android BuildTools 28.0.3
To update the Android SDK visit https://flutter.dev/to/macos-android-setup for detailed instructions.
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 26.2) [3.3s]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 17C52
• CocoaPods version 1.16.2

[✓] Chrome - develop for the web [6ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Connected device (2 available) [7.0s]
• macOS (desktop) • macos • darwin-arm64 • macOS 26.3.1 25D771280a darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 147.0.7727.56
! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this
Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources [297ms]
• All expected network resources are available.

! Doctor found issues in 1 category.

Activity

  1. added
    in triagePresently being triaged by the triage team
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    needs repro infoAutomated crash report whose cause isn't yet known
    platform-webWeb applications specifically
    and removed
    in triagePresently being triaged by the triage team
    on Apr 11, 2026
  2. mbcorona commented on Apr 11, 2026

    @mbcorona
    Member

    Hi @tarunshri , I tried to reproduce the issue reported by following the steps provided, but the app behaves correctly after dragging items for more than 20s. Can you share a video evidence that can help us to understand the issue you are experiencing?

    Also, you mentioned Chrome 146, but I can see Google Chrome 147.0.7727.56 on the Flutter Doctor output you shared.

  3. tarunshri commented on Apr 11, 2026

    @tarunshri
    Author

    Hi Bruno,

    https://jumpshare.com/s/DdR9woxx8z6Zc8OFmSPA
    Please find the link to the video showing the screen freezing twice.
    Tried to attach video here but fails.
    And yes my Chrome is 147.7727.56. The bug report was created using AI. My apologies for the wrong version. If there is anything specific from console or if u would like to have specific code, do let me know. Thanks,

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Apr 11, 2026
  5. mbcorona commented on Apr 13, 2026

    @mbcorona
    Member

    @tarunshri We cannot reproduce the issue using the provided code sample, and the video link you provided is returning a 404 error, you should be able to share it here by drag and drop,

    To properly investigate and route this issue to the engine team, we need:

    • A complete, runnable minimal reproduction project (such as a GitHub repository) that consistently triggers the crash.

    • Exact, step-by-step instructions on how to trigger the freeze using that specific project.

    Once you provide these, we will gladly take another look.

  6. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Apr 13, 2026
  7. added
    👍Issue needs retriaging to evaluate its popularity
    and removed
    👍Issue needs retriaging to evaluate its popularity
    on Apr 25, 2026
  8. davidmigloz commented on Apr 28, 2026

    @davidmigloz
    Contributor

    Adding evidence from a sibling crash we hit in production. Same family but the trap surfaces on the allocation side rather than the dispose side.

    Environment

    • Flutter 3.41.7 stable, engine hash 59aa584fdf100e6c78c785d8a5b565d1de4b48ab
    • Built with flutter build web --wasm --source-maps, release mode

    The trap

    Initial frame: wasm-function[299]:0xedc7 in skwasm.wasm. The ancestor chain crosses 28 Skwasm frames before reaching main.dart.wasm.

    Pulled the public binary at https://www.gstatic.com/flutter-canvaskit/59aa584fdf100e6c78c785d8a5b565d1de4b48ab/skwasm.wasm and ran wasm-objdump -x against it. The Name section gives readable symbols:

    • func[299] is malloc, signature (i32) -> i32.
    • The trap instruction at offset 0xedc7 is i32.load 2 4, reading the head field at chunk[+4] inside dlmalloc's free-list walk.
    • func[5657] is a two-instruction operator new trampoline: local.get 1; call 299.
    • func[301] does a call_indirect, looks like a virtual allocator dispatch.
    • func[10139] is paragraph_layout, Skwasm's public C API.

    So the chain reads: Dart calls paragraph_layout → Skia text shaping (~28 frames) → allocator → operator new → malloc → free-list walk hits a corrupted chunk pointer and traps.

    Why this looks like the same bug

    The traps in the original report are in paragraphBuilder_dispose and textStyle_dispose, both on the deallocation side. The trap here is on the allocation side, but the heap state at the trap site (corrupted free-list chunk metadata) is what you'd expect if a stack-allocated pointer escaped its lifetime and overwrote heap bookkeeping earlier. That matches the failure mode PR #183022 partially fixed for SkwasmSurface.rasterizeToImageBitmaps. The withStackScope assert() added there is stripped in release wasm-gc builds, so the API still relies on convention.

    If the underlying corruption is the same, the surface trap can land in either an allocator walk or a free path depending on which allocation reaches the corrupted region first. Heap layout decides.

    No repro

    I tried four candidate Dart programs (paragraph stress, animated style rebuilds, deeply nested TextSpan, and a port of the original ReorderableListView pattern). None crashed across 5+ minutes of headed Chrome interaction.

  9. added
    a: typographyText rendering, possibly libtxt
    fyi-engineFor the attention of Engine team
    team-webOwned by Web platform team
    and removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    needs repro infoAutomated crash report whose cause isn't yet known
    on Apr 28, 2026
  10. mbcorona commented on Apr 28, 2026

    @mbcorona
    Member

    Hi @davidmigloz , thanks for the analysis. Routing to the web team for investigation.

  11. gaaclarke commented on Apr 28, 2026

    @gaaclarke
    Member

    fyi @harryterkelsen this sounds related to some of the work you've done.

  12. flutter-zl commented on Apr 29, 2026

    @flutter-zl
    Contributor

    Hi @tarunshri , can you try the latest stable version 3.41.8 which includes the fix to the similar issue?

  13. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Apr 29, 2026
  14. github-actions commented on May 20, 2026

    @github-actions

    Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.

    If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.

    Thanks for your contribution.

  15. github-actions commented on Jul 14, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  16. locked as resolved and limited conversation to collaborators on Jul 14, 2026
  17. added a commit that references this issue on Aug 5, 2026
    d3ac5cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: typographyText rendering, possibly libtxtplatform-webWeb applications specificallyteam-webOwned by Web platform teamwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions