[Web][Canvaskit] Image decode crash on non-Blink browsers

This issue has been created since 2022-11-23.

Steps to Reproduce

  1. Clone the repo and run the web server
git clone https://github.com/umberto-sonnino/flutter_web_decode_bug.git
cd flutter_web_decode_bug
flutter run -d web-server --web-renderer canvaskit
  1. Open the app in a non-Blink browser (i.e. Firefox or Safari) and open up the Developer Console
  2. Click on 'Get Codecs' and wait for the console crash after a few images have been decoded

Expected results:
Decoding the images doesn't crash

Actual results:
I've seen different crashes depending on the browser.
Firefox Developer Edition v108.0b5:
Uncaught (in promise) Error: ImageCodecException: Failed to decode image data. Image source: encoded image bytes

StackTrace:

DartError dart_sdk.js:7028
    throw_ errors.dart:266
    createDefault image_wasm_codecs.dart:36
    new skia_object_cache.dart:222
    decodeFromBytes image_wasm_codecs.dart:21
    skiaInstantiateImageCodec image.dart:22
    instantiateImageCodec painting.dart:480
    runBody async_patch.dart:84
    _async async_patch.dart:123
    instantiateImageCodec painting.dart:473
    _initCodecs main.dart:47
    runUnary zone.dart:1653
    handleValue future_impl.dart:147
    handleValueCallback future_impl.dart:766
    _propagateToListeners future_impl.dart:795
    _completeWithValue future_impl.dart:566
    <anonymous> future_impl.dart:639
    _microtaskLoop schedule_microtask.dart:40
    _startMicrotaskLoop schedule_microtask.dart:49
    _scheduleImmediateWithPromise async_patch.dart:166
    promise callback*_scheduleImmediateWithPromise async_patch.dart:164
    _scheduleImmediate async_patch.dart:136
    _scheduleAsyncCallback schedule_microtask.dart:69
    _rootScheduleMicrotask zone.dart:1458
    scheduleMicrotask zone.dart:1673
    _asyncCompleteWithValue future_impl.dart:638
    _asyncComplete future_impl.dart:598
    complete future_impl.dart:36
    send binding.dart:366
    runUnaryGuarded zone.dart:1586
    _zonedPlatformMessageResponseCallback platform_dispatcher.dart:381
    replyToPlatformMessage platform_dispatcher.dart:1138
    runUnary zone.dart:1653
    handleValue future_impl.dart:147
    handleValueCallback future_impl.dart:766
    _propagateToListeners future_impl.dart:795
    _complete future_impl.dart:557
    delayed future.dart:421
    internalCallback isolate_helper.dart:48
    setTimeout handler*load__dart_sdk/_isolate_helper.TimerImpl.new isolate_helper.dart:55
    _createTimer async_patch.dart:186
    createTimer zone.dart:1677
    new timer.dart:51
    delayed future.dart:419
    replyToPlatformMessage platform_dispatcher.dart:1136
    <anonymous> platform_dispatcher.dart:437
    runUnary zone.dart:1653
    handleValue future_impl.dart:147
    handleValueCallback future_impl.dart:766
    _propagateToListeners future_impl.dart:795
    _completeWithValue future_impl.dart:566
    <anonymous> future_impl.dart:639
    _microtaskLoop schedule_microtask.dart:40
    _startMicrotaskLoop schedule_microtask.dart:49
    _scheduleImmediateWithPromise async_patch.dart:166
    promise callback*_scheduleImmediateWithPromise async_patch.dart:164
    _scheduleImmediate async_patch.dart:136
    _scheduleAsyncCallback schedule_microtask.dart:69
    _rootScheduleMicrotask zone.dart:1458
    scheduleMicrotask zone.dart:1673
    _asyncCompleteWithValue future_impl.dart:638
    _asyncComplete future_impl.dart:598
    complete future_impl.dart:36
    domHttpRequest dom.dart:733
    _checkAndCall operations.dart:334
    dcall operations.dart:339
    ret dart_sdk.js:62137
    callMethod$ js_util_patch.dart:80
    DomEventTargetExtension$124addEventListener dom.dart:136
    domHttpRequest dom.dart:726
    load assets.dart:61
    runBody async_patch.dart:84
    _async async_patch.dart:123
    load assets.dart:57
    _sendPlatformMessage platform_dispatcher.dart:436
    sendPlatformMessage platform_dispatcher.dart:326
    send binding.dart:364
    load asset_bundle.dart:256
    runBody async_patch.dart:84
    _async async_patch.dart:123
    load asset_bundle.dart:253
    _initCodecs main.dart:48
    moveNext iterable.dart:391
    next dart_sdk.js:7061
    wait future.dart:520
    _initCodecs main.dart:43
    _async async_patch.dart:45
    runUnary zone.dart:1653
    handleValue future_impl.dart:147
    handleValueCallback future_impl.dart:766
    _propagateToListeners future_impl.dart:795
    _completeWithValue future_impl.dart:566
    <anonymous> future_impl.dart:639
[dart_sdk.js:7028:7](http://localhost:57101/dart_sdk.js)
    _startMicrotaskLoop schedule_microtask.dart:54
    _scheduleImmediateWithPromise async_patch.dart:166
    (Async: promise callback)
    _scheduleImmediateWithPromise async_patch.dart:164
    _scheduleImmediate async_patch.dart:136
    _scheduleAsyncCallback schedule_microtask.dart:69
    _rootScheduleMicrotask zone.dart:1458
    scheduleMicrotask zone.dart:1673
    _asyncCompleteWithValue future_impl.dart:638
    _asyncComplete future_impl.dart:598
    complete future_impl.dart:36
    send binding.dart:366
    runUnaryGuarded zone.dart:1586
    _zonedPlatformMessageResponseCallback platform_dispatcher.dart:381
    replyToPlatformMessage platform_dispatcher.dart:1138
    runUnary zone.dart:1653
    handleValue future_impl.dart:147
    handleValueCallback future_impl.dart:766
    _propagateToListeners future_impl.dart:795
    _complete future_impl.dart:557
    delayed future.dart:421
    internalCallback isolate_helper.dart:48
    (Async: setTimeout handler)
    new isolate_helper.dart:55
    _createTimer async_patch.dart:186
    createTimer zone.dart:1677
    new timer.dart:51
    delayed future.dart:419
    replyToPlatformMessage platform_dispatcher.dart:1136
    <anonymous> platform_dispatcher.dart:437
    runUnary zone.dart:1653
    handleValue future_impl.dart:147
    handleValueCallback future_impl.dart:766
    _propagateToListeners future_impl.dart:795
    _completeWithValue future_impl.dart:566
    <anonymous> future_impl.dart:639
    _microtaskLoop schedule_microtask.dart:40
    _startMicrotaskLoop schedule_microtask.dart:49
    _scheduleImmediateWithPromise async_patch.dart:166
    (Async: promise callback)
    _scheduleImmediateWithPromise async_patch.dart:164
    _scheduleImmediate async_patch.dart:136
    _scheduleAsyncCallback schedule_microtask.dart:69
    _rootScheduleMicrotask zone.dart:1458
    scheduleMicrotask zone.dart:1673
    _asyncCompleteWithValue future_impl.dart:638
    _asyncComplete future_impl.dart:598
    complete future_impl.dart:36
    domHttpRequest dom.dart:733
    _checkAndCall operations.dart:334
    dcall operations.dart:339
    ret dart_sdk.js:62137
    (Async: EventListener.handleEvent)
    callMethod$ js_util_patch.dart:80
    DomEventTargetExtension$124addEventListener dom.dart:136
    domHttpRequest dom.dart:726
    load assets.dart:61
    next self-hosted:1740
    runBody async_patch.dart:84
    _async async_patch.dart:123
    load assets.dart:57
    _sendPlatformMessage platform_dispatcher.dart:436
    sendPlatformMessage platform_dispatcher.dart:326
    send binding.dart:364
    load asset_bundle.dart:256
    next self-hosted:1740
    runBody async_patch.dart:84
    _async async_patch.dart:123
    load asset_bundle.dart:253
    _initCodecs main.dart:48
    moveNext iterable.dart:391
    next dart_sdk.js:7061
    wait future.dart:520
    _initCodecs main.dart:43
    InterpretGeneratorResume self-hosted:1819
    next self-hosted:1740
    _async async_patch.dart:45
    runUnary zone.dart:1653
    handleValue future_impl.dart:147
    handleValueCallback future_impl.dart:766
    _propagateToListeners future_impl.dart:795
    _completeWithValue future_impl.dart:566
    <anonymous> future_impl.dart:639

Safari v16.1:
Unhandled Promise Rejection Error

StackTrace:

throw _ -- errors.dart:266
  collectSkiaObjectsNow -- canvaskit_api.dart:2376
  (anonymous function) -- canvaskit_api:2324
  internalCallback -- isolate helper:48

This is running on macOS 13.0.1
Flutter version 3.3.7
Dart 2.18.4

huycozy wrote this answer on 2022-11-24

@umberto-sonnino, thanks for filing the issue. This issue is reproducible on the latest stable and master channels with provided sample code.
It's only reproducible when running with canvaskit renderer.

  • Canvaskit:
  • HTML:

: No Issue : Issue reproduced

flutter doctor -v (stable and master)
[✓] Flutter (Channel stable, 3.3.9, on macOS 13.0 22A380 darwin-x64, locale en-VN)
    • Flutter version 3.3.9 on channel stable at /Users/huynq/Documents/GitHub/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b8f7f1f986 (31 hours ago), 2022-11-23 06:43:51 +0900
    • Engine revision 8f2221fbef
    • Dart version 2.18.5
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/huynq/Library/Android/sdk
    • Platform android-33, build-tools 31.0.0
    • ANDROID_HOME = /Users/huynq/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14A400
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2021.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] IntelliJ IDEA Community Edition (version 2022.2.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 70.0.5
    • Dart plugin version 222.4167.21

[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
    • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.73.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.52.0

[✓] Connected device (3 available)
    • SM T225 (mobile) • R9JT3004VRJ • android-arm64  • Android 12 (API 31)
    • macOS (desktop)  • macos       • darwin-x64     • macOS 13.0 22A380 darwin-x64
    • Chrome (web)     • chrome      • web-javascript • Google Chrome 107.0.5304.110

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
[!] Flutter (Channel master, 3.6.0-7.0.pre.45, on macOS 13.0 22A380 darwin-x64, locale en-VN)
    • Flutter version 3.6.0-7.0.pre.45 on channel master at /Users/huynq/Documents/GitHub/flutter_master
    ! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d0352f55db (3 hours ago), 2022-11-23 20:01:26 -0500
    • Engine revision 9b2895724c
    • Dart version 2.19.0 (build 2.19.0-424.0.dev)
    • DevTools version 2.19.0
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/huynq/Library/Android/sdk
    • Platform android-33, build-tools 31.0.0
    • ANDROID_HOME = /Users/huynq/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14A400
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2021.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] IntelliJ IDEA Community Edition (version 2022.2.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 70.0.5
    • Dart plugin version 222.4167.21

[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
    • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.73.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.52.0

[✓] Connected device (3 available)
    • SM T225 (mobile) • R9JT3004VRJ • android-arm64  • Android 12 (API 31)
    • macOS (desktop)  • macos       • darwin-x64     • macOS 13.0 22A380 darwin-x64
    • Chrome (web)     • chrome      • web-javascript • Google Chrome 107.0.5304.110

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
yjbanov wrote this answer on 2022-12-01

Is it the 100000x100000 one by any chance?

caudetgit wrote this answer on 2022-12-02

@yjbanov The issue isn't specific to that sample image, if that's the question. And that image is actually 4000x1080 and not 100k x 100k (unfortunate filename).

More Details About Repo
Owner Name flutter
Repo Name flutter
Full Name flutter/flutter
Language Dart
Created Date 2015-03-06
Updated Date 2022-12-10
Star Count 147243
Watcher Count 3561
Fork Count 23950
Issue Count 11325

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Clarification of SwAV's forward method 1 2021-12-11 2022-11-24
The repository is inconsistent with the tutorial. 1 2022-07-06 2022-11-12
[ChannelTabs] Issue: plugin interfering with Discord 11 theme window buttons 7 2022-04-12 2022-07-15
Saving and retrieving settings for different users 2 2018-08-16 2022-11-28
Unable to Log Into iOS Application 9 2022-07-13 2022-10-14
[bug] WalletConnect causes 500 Internal Server Error in NextJS production 3 2022-04-12 2022-12-03
Black Video on Android 4 2022-08-04 2022-10-09
Difficulty in cutting h264 recordings 3 2022-06-30 2022-11-19
new DDF attached... Tuya TS0601 Temp & Humidy Sensor TZE200 1 2022-06-24 2022-11-01
BuildTools analyzers don't work on records 5 2021-04-19 2022-11-15
Create NestJS module wrapper 9 2021-10-30 2022-09-25
Error building: missing go dependencies 2 2021-07-03 2022-12-03
Twin + stitches breaks gatsby production build 1 2021-06-13 2022-10-17
rsz: repair_design not repairing all slew violations 4 2022-10-10 2022-12-01
MTU和splitWriteNum的使用问题 1 2021-02-27 2022-11-30
连接成功后,过几秒再发送数据,蓝牙设备没有响应。 2 2021-01-15 2022-11-30
Ability to use Command line tool PD to do all 0 2022-09-10 2022-11-26
binaryType useWebSocket and best practice 1 2022-01-22 2022-12-09
(chore) Update element-web to v1.10.3 0 2022-02-15 2022-10-14
Dependency Dashboard 0 2021-10-19 2022-11-28
calculate the mAP on each output video 1 2022-04-19 2022-11-22
Issue using redis_pool and watchgod reloading 0 2022-06-17 2022-11-28
Save data as .parquet files 0 2022-03-06 2022-12-01
Create new container-image-sbom orb using Syft 0 2021-04-11 2022-12-08
PHPSTAN: Diagnostic for class-level errors seems to have a fixed length 0 2021-06-09 2022-11-19
Add Web Support 2 2021-11-02 2022-01-16
checksum of ytt is not working since 0.31.0 5 2021-01-18 2022-12-09
"Allow Users to Preupload Presentations" Site Settings 0 2022-03-07 2022-11-11
Delete Server Recordings 0 2022-03-07 2022-11-13
创建工单所属项目的产品数量不对 1 2021-11-12 2022-01-14
Question - Torrent port and speed 2 2022-04-27 2022-09-14
Reservation Error Message Disappears Too Quickly 0 2022-10-07 2022-12-06
perilaku yang diharapkan 1 2022-04-29 2022-05-11
Harbor ingress and Notary ingress share the same TLS secret name 3 2021-10-08 2022-11-02
Install master with helm3 failed 1 2021-10-20 2022-09-26
Fingerprint unlock is not working 4 2022-11-16 2022-11-26
www.timeout.com 0 2021-12-28 2021-12-22
samples/manager wont work when serviceAccount option specified 2 2020-06-03 2022-12-10
gadgetbridge 2 2021-05-13 2022-01-01
Cannot update client 0 2020-06-15 2022-12-08
az_span_copy, az_span_from_str backsplash escape issue 6 2022-04-06 2022-11-10
Change scale at runtime 2 2021-07-16 2022-12-06
mruby doesn't install requirements before checking for bison 0 2021-07-22 2022-10-26
Replace "blacklist / whitelist" terminology in Gradle build environment configuration 0 2022-03-14 2022-09-15
多卡训练Retry to connect to 0.1.68.146:39291 while the server is not yet listening.[Bug] 3 2022-11-28 2022-12-03
[Bug] [DataSource] mysql 8 jdbc connect failed 4 2022-02-04 2022-11-06
UI list pods from multiple statefulset if they share the same label 0 2022-11-25 2022-12-01
Make the "example compiler gym service" work without bazel 1 2021-09-21 2022-11-26
Projecting images using class-conditional GANs 4 2021-07-21 2022-12-06
StreamsBuilderFactoryBean#start blocks Spring application startup with large global stores 6 2021-08-03 2022-10-25