Skip to content

Isolate group callbacks can capture mutable late final variables. #62181

@alexmarkov

Description

@alexmarkov

Example:

import 'dart:ffi';

void main(List<String> args) {
  late final List<String> list;
  final callback = NativeCallable<Void Function()>.isolateGroupBound(() {
    list.add('hey');
  });
  list = [];
  callback.nativeFunction.asFunction<void Function()>().call();
  print(list);
  callback.close();
}

late final variables can be initialized later, after isolate group callback is created, so they are somewhat mutable. This would bypass check that values of captured variables are shareable and would allow sharing arbitrary mutable Dart objects between isolate group callback and Dart isolate.

/cc @aam

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions