Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Reflection] Fix overrun when reading field records of nonstandard size.#88628

Merged
mikeash merged 1 commit into
swiftlang:mainfrom
mikeash:remote-mirror-field-descriptor-size-fix
May 15, 2026
Merged

[Reflection] Fix overrun when reading field records of nonstandard size.#88628
mikeash merged 1 commit into
swiftlang:mainfrom
mikeash:remote-mirror-field-descriptor-size-fix

Conversation

@mikeash
Copy link
Copy Markdown
Contributor

@mikeash mikeash commented Apr 23, 2026

When we read field descriptors, we compute the size of each one and bail out if it goes past the end of the section. The size consists of the header, plus record size multiplied by count. However, when we iterate, we ignore the record size and just iterate using the known standard size. If the record size field is smaller than standard, especially zero, we can go off the end of the section. This only happens with corrupt data, but we do want to gracefully handle corrupt data.

rdar://175435261

When we read field descriptors, we compute the size of each one and bail out if it goes past the end of the section. The size consists of the header, plus record size multiplied by count. However, when we iterate, we ignore the record size and just iterate using the known standard size. If the record size field is smaller than standard, especially zero, we can go off the end of the section. This only happens with corrupt data, but we do want to gracefully handle corrupt data.

rdar://175435261
@mikeash mikeash requested a review from a team as a code owner April 23, 2026 16:58
@mikeash
Copy link
Copy Markdown
Contributor Author

mikeash commented May 14, 2026

@swift-ci please test

@mikeash mikeash enabled auto-merge May 14, 2026 15:00
@mikeash
Copy link
Copy Markdown
Contributor Author

mikeash commented May 15, 2026

@swift-ci please test windows platform

@mikeash mikeash merged commit d2cd2e5 into swiftlang:main May 15, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants