Skip to content

[Impeller] App crashes on wide-gamut indexed PNG decompression in Skia with wide-gamut enabled. #133013

@nerder

Description

@nerder

Is there an existing issue for this?

Steps to reproduce

Simply running an app that contains an AssetImage containing a large image (~1MB) causes the app to crash in IOS.

As per my logs, this is happening starting from v3.13.0.

Expected results

The app not to crash

Actual results

The app crashes

Code sample

I've reproduced the bug in this small repository: https://github.com/nerder/ios_crash_asset_image

NOTE: I've also added a compressed version of the same image which instead will work. I couldn't manage to find the exact number of bytes that an image needs to be to generate the crash.

Logs

Logs
(lldb) 2023-08-22 03:03:47.288767+0200 Runner[8957:3341508] [VERBOSE-2:FlutterDarwinContextMetalImpeller.mm(37)] Using the Impeller rendering backend.
Warning: Unable to create restoration in progress marker file
fopen failed for data file: errno = 2 (No such file or directory)
Errors found! Invalidating cache...
Debug service listening on ws://127.0.0.1:53633/mepV6IrsO1k=/ws
Syncing files to device iPhone de XXX..
* thread #18, name = 'io.worker.6', stop reason = EXC_BAD_ACCESS (code=1, address=0x38)
    frame #0: 0x0000000104f27f5c Flutter`SkPngCodec::applyXformRow(void*, void const*) + 52
Flutter`SkPngCodec::applyXformRow:
->  0x104f27f5c <+52>: ldp    w5, w8, [x9, #0x38]
    0x104f27f60 <+56>: sxtw   x8, w8
    0x104f27f64 <+60>: add    x0, x19, x8
    0x104f27f68 <+64>: ldr    w8, [x9, #0x48]
Target 0: (Runner) stopped.
Lost connection to device.

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.13.0, on macOS 13.3.1 22E772610a darwin-arm64, locale en-IT)
    • Flutter version 3.13.0 on channel stable at /Users/nerder/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision efbf63d9c6 (6 days ago), 2023-08-15 21:05:06 -0500
    • Engine revision 1ac611c64e
    • Dart version 3.1.0
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/nerder/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Users/nerder/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.10406996/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

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

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/nerder/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.10121639/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 17.0.6+0-17.0.6b802.4-9586694)

[✓] Android Studio (version 2022.3)
    • Android Studio at /Users/nerder/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.10406996/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 17.0.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2)
    • IntelliJ at /Users/nerder/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 74.0.4
    • Dart plugin version 231.9392.3

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2)
    • IntelliJ at /Users/nerder/Library/Application
      Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/232.8660.185/IntelliJ IDEA.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

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.5)
    • IntelliJ at /Users/nerder/Library/Application
      Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.9392.1/IntelliJ IDEA.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

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.4)
    • IntelliJ at /Users/nerder/Library/Application
      Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.9225.16/IntelliJ IDEA.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

[✓] Connected device (1 available)
    • macOS (desktop)                 • macos                     • darwin-arm64 • macOS 13.3.1 22E772610a
      darwin-arm64

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

• No issues found!

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: imagesLoading, displaying, rendering imagesc: fatal crashCrashes that terminate the processdependency: skiaSkia team may need to help use: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.found in release: 3.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-engineOwned by Engine teamtriaged-engineTriaged by Engine teamwaiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions