Skip to content

Passing an implemented dart:ui NativeFieldClassWrapper2 type to the engine segfaults #64598

Description

@dnfield

There are a lot of ways this could happen, but consider the following test:

import 'dart:typed_data';
import 'dart:ui';

import 'package:flutter_test/flutter_test.dart';

void main() {
  test('another', () async {
    const TestImage image = TestImage();
    final PictureRecorder recorder = PictureRecorder();
    final Canvas canvas = Canvas(recorder);
    canvas.drawImage(image, Offset.zero, Paint());
    final Picture picture = recorder.endRecording();
  });
}

class TestImage implements Image {
  const TestImage([this.width = 10, this.height = 10]);

  @override
  final int height;

  @override
  final int width;

  @override
  Future<ByteData> toByteData({ImageByteFormat format = ImageByteFormat.rawRgba}) {
    throw UnimplementedError();
  }

  @override
  void dispose() {}
}

I don't think we should support this, but we shouldn't segfault either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our testsc: crashStack traces logged to the consoledependency: dartDart team may need to help usengineflutter/engine related. See also e: labels.found in release: 1.22Found to occur in 1.22has reproducible stepsThe issue has been confirmed reproducible and is ready to work on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions