Skip to content

[6.0] Serialization: Protect against most errors in contexts for calls to AnyObject variables #73139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 19, 2024

Conversation

xymus
Copy link
Contributor

@xymus xymus commented Apr 19, 2024

Recover from deserialization errors in accesses to the context in all deserialize* functions. Calls on a AnyObject typed variable triggers access to all loaded class members directly. The context of these members can be non-public or broken by a context change. Make sure most context accesses can recover from this and bubble up any error instead of crashing.

xymus added 2 commits April 19, 2024 08:08
Non-error resilient call sites like this:

  DeclContext *DC = MF.getDeclContext(contextID);

Can be replaced with this error tolerant alternative:

  DeclContext *DC;
  UNWRAP(MF.getDeclContextChecked(contextID), DC);
@xymus xymus added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.0 labels Apr 19, 2024
@xymus xymus requested a review from nkcsgexi April 19, 2024 15:15
@xymus xymus requested a review from a team as a code owner April 19, 2024 15:15
@xymus
Copy link
Contributor Author

xymus commented Apr 19, 2024

@swift-ci Please test

@xymus xymus changed the title Serialization: Protect against most errors in contexts for calls to AnyObject variables [6.0] Serialization: Protect against most errors in contexts for calls to AnyObject variables Apr 19, 2024
@xymus xymus merged commit 4d3307a into swiftlang:release/6.0 Apr 19, 2024
@xymus xymus deleted the serial-get-context-6.0 branch April 19, 2024 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants