Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@ftsui
Copy link
Contributor

@ftsui ftsui commented Aug 3, 2023

When setting up the paths to assets and ICU data, we were previously returning the underlying char* data in a temporary string returned by std::filesystem::path::string(). Since the return value of string() is never stored, there's no guarantee that the underlying data pointer is still valid later in the function. By storing the string in a local whose lifetime exceeds that of the running engine instance, we guarantee the string isn't freed until after the Flutter app terminates.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

- Use after free due to use of c_str() from temp std::string variables.
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@zanderso zanderso requested a review from cbracken August 4, 2023 19:54
Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouch. Nicely spotted. Thanks for catching and fixing this.

lgtm.

@cbracken cbracken changed the title Fix crash in glfw embedder. Fix use-after-free crash in Linux glfw embedder Aug 7, 2023
@cbracken cbracken changed the title Fix use-after-free crash in Linux glfw embedder Fix use-after-free crash in glfw embedder Aug 7, 2023
@Hixie
Copy link
Contributor

Hixie commented Aug 7, 2023

test-exempt: would need ASAN but that's not currently affordable on our CI.

@cbracken cbracken added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 7, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Aug 7, 2023

auto label is removed for flutter/engine/44358, due to This PR has not met approval requirements for merging. You are not a member of flutter-hackers and need 1 more review(s) in order to merge this PR.

  • Merge guidelines: You need at least one approved review if you are already part of flutter-hackers or two member reviews if you are not a flutter-hacker before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 7, 2023
Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cbracken cbracken added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 7, 2023
@auto-submit auto-submit bot merged commit 4505525 into flutter:main Aug 7, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 8, 2023
fluttermirroringbot pushed a commit to flutter/flutter that referenced this pull request Aug 8, 2023
…132108)

flutter/engine@c271092...9c83d90

2023-08-07 [email protected] Roll Dart SDK from 0816d590a220 to f664f4b9c50d (1 revision) (flutter/engine#44462)
2023-08-07 [email protected] [Impeller] Flutter GPU: Add GpuContext. (flutter/engine#44359)
2023-08-07 [email protected] Fix use-after-free crash in glfw embedder (flutter/engine#44358)
2023-08-07 [email protected] Roll Skia from 9fbd7296de9a to d1ada6624536 (1 revision) (flutter/engine#44447)
2023-08-07 [email protected] Revert clang back to 6d667d4b261e81f325756fdfd5bb43b3b3d2451d (flutter/engine#44442)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@reidbaker reidbaker mentioned this pull request Aug 15, 2023
14 tasks
gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request Aug 30, 2023
When setting up the paths to assets and ICU data, we were previously returning the underlying char* data in a temporary string returned by `std::filesystem::path::string()`. Since the return value of `string()` is never stored, there's no guarantee that the underlying data pointer is still valid later in the function. By storing the string in a local whose lifetime exceeds that of the running engine instance, we guarantee the string isn't freed until after the Flutter app terminates.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants