Skip to content

[ClangImporter] Handle lookup tables with many entries #17265

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 1 commit into from
Jun 18, 2018

Conversation

jrose-apple
Copy link
Contributor

In particular, there are frameworks with more than 65536 entries for init as a base name.

I can't think of a test case for this besides actually adding such a massive framework, but the assertions that were added here should catch the issue in Debug builds if it ever comes up again. I'm going to go harden everything else that uses this API next (llvm::endian::Writer).

rdar://problem/40828315

In particular, there are frameworks with more than 65536 entries for
'init' as a base name.

I can't think of a test case for this besides actually adding such a
massive framework, but the assertions that were added here should
catch the issue in Debug builds if it ever comes up again. I'm going
to go harden everything else that uses this API next.

rdar://problem/40828315
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test source compatibility

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

LGTM.

I don't know why the keyLength was a uint32_t previously, but it makes total sense now with your asserts.


// # of entries
uint32_t dataLength =
sizeof(uint16_t) + sizeof(uint64_t) * data.size();
assert(dataLength == static_cast<uint16_t>(dataLength));
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn’t this be checking against uint32_t?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this is a different table, which I didn't change.

@jrose-apple jrose-apple merged commit 864bf89 into swiftlang:master Jun 18, 2018
@jrose-apple jrose-apple deleted the downright-up-and-left branch June 18, 2018 15:39
jrose-apple added a commit to jrose-apple/swift that referenced this pull request Jun 18, 2018
In particular, there are frameworks with more than 65536 entries for
'init' as a base name.

I can't think of a test case for this besides actually adding such a
massive framework, but the assertions that were added here should
catch the issue in Debug builds if it ever comes up again. I'm going
to go harden everything else that uses this API next.

rdar://problem/40828315
(cherry picked from commit 864bf89)
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.

3 participants