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

Conversation

@tgucio
Copy link
Contributor

@tgucio tgucio commented Aug 2, 2022

This PR adds a check for string max length in Utf8FromUtf16 and Utf16FromUtf8, similar to flutter/flutter#99729 / flutter/flutter#94608.

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 [relevant style guides] and ran [the auto-formatter]. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the [CLA].
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes].
  • I updated CHANGELOG.md to add a description of the change, [following repository CHANGELOG style].
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

@tgucio tgucio requested a review from cbracken as a code owner August 2, 2022 11:39
@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.

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.

Did you encounter a bug that led to this patch? If so, please list it in the PR description and add a test that replicates the failure.

@tgucio
Copy link
Contributor Author

tgucio commented Aug 3, 2022

@cbracken not really a particular issue - same story as flutter/flutter#94608 (found through code audit vs. Win32 API docs).

@cbracken
Copy link
Member

cbracken commented Aug 3, 2022

Thanks. Normally we'd ask for a test, but I'm not sure we necessarily want to add a test that involves passing a string longer than std::string::max_size which, in a quick test on my machine, is 9 exabytes, or roughly 1 million American Libraries of Congress.

std::string::max_size is an instance method, and I suppose could return different values under different circumstances, or in some future libc++ update, or if we switch libc++ implementations, and this does update the check to be safe according to the std::string::resize documentation, so seems reasonable to land.

It will need a test exemption though.

@tgucio tgucio requested a review from cbracken August 3, 2022 17:44
@Hixie
Copy link
Contributor

Hixie commented Aug 3, 2022

test-exempt: not practically testable

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.

Thanks for your contribution.

LGTM stamp from a Japanese personal seal

@tgucio
Copy link
Contributor Author

tgucio commented Aug 3, 2022

@cbracken Great, camera_windows will be safe against 1+ million American Libraries of Congress string attacks :-).
Could you slap the automerge label as I don't have write access?

I see the submit-queue/CI failures in other plugin PRs so I'll sync from main to see if it unclogs things.

@cbracken cbracken merged commit f0c0c9d into flutter:main Aug 4, 2022
@cbracken
Copy link
Member

cbracken commented Aug 4, 2022

Thanks!

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 5, 2022
yutaaraki-toydium pushed a commit to yutaaraki-toydium/plugins that referenced this pull request Aug 12, 2022
…r conversions (flutter#6170)

This PR adds a check for string max length in Utf8FromUtf16 and Utf16FromUtf8, similar to flutter/flutter#99729 / flutter/flutter#94608.
moisefeelin pushed a commit to feelinproject/plugins that referenced this pull request Aug 26, 2022
…r conversions (flutter#6170)

This PR adds a check for string max length in Utf8FromUtf16 and Utf16FromUtf8, similar to flutter/flutter#99729 / flutter/flutter#94608.
mauricioluz pushed a commit to mauricioluz/plugins that referenced this pull request Jan 26, 2023
…r conversions (flutter#6170)

This PR adds a check for string max length in Utf8FromUtf16 and Utf16FromUtf8, similar to flutter/flutter#99729 / flutter/flutter#94608.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants