From 19e8b949e46a4197c33b6247a2789135719da544 Mon Sep 17 00:00:00 2001 From: Darren Chan <74682667+chandarrengoog@users.noreply.github.com> Date: Tue, 29 Jun 2021 19:42:52 -0400 Subject: [PATCH] Fix use-after-free. (flutter/engine#27053) Switch from `fml::NonOwnedMapping` to `fml::DataMapping`. All other uses of `fml::NonOwnedMapping` are not in `PlatformView` and do not access data after references are out of scope. This fixes https://fxbug.dev/77924. --- .../flutter/shell/platform/fuchsia/flutter/platform_view.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/platform_view.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/platform_view.cc index 2849e918bb..b2260088ae 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/platform_view.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/platform_view.cc @@ -964,9 +964,8 @@ bool PlatformView::HandleFlutterPlatformViewsChannelPlatformMessage( // The client is waiting for view creation. Send an empty response // back to signal the view was created. if (message->response()) { - message->response()->Complete( - std::make_unique((const uint8_t*)"[0]", - 3u)); + message->response()->Complete(std::make_unique( + std::vector({'[', '0', ']'}))); } }); auto on_view_bound =