Skip to content
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

Error out when struct size is bigger than int.MaxValue #104393

Merged
merged 20 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/coreclr/vm/classlayoutinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ namespace
LayoutRawFieldInfo* pfwalk = *pSortWalk;
RawFieldPlacementInfo* placementInfo = &pfwalk->m_placement;

if (placementInfo->m_size > FIELD_OFFSET_LAST_REAL_OFFSET)
fanyang-mono marked this conversation as resolved.
Show resolved Hide resolved
COMPlusThrow(kTypeLoadException, W("TypeLoad_FieldSizeTooBig"));

BYTE alignmentRequirement = (BYTE)placementInfo->m_alignment;

alignmentRequirement = min(alignmentRequirement, packingSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3653,6 +3653,9 @@
<data name="TypeLoad_ResolveTypeFromAssembly" xml:space="preserve">
<value>Could not resolve type '{0}' in assembly '{1}'.</value>
</data>
<data name="TypeLoad_FieldSizeTooBig" xml:space="preserve">
fanyang-mono marked this conversation as resolved.
Show resolved Hide resolved
<value>Type load failed, because the size of a field is too big.</value>
</data>
<data name="UnauthorizedAccess_IODenied_NoPathName" xml:space="preserve">
<value>Access to the path is denied.</value>
</data>
Expand Down
Loading