Skip to content

Conversation

@MrSoup678
Copy link

The c# side allocation of BSTRs incorrectly uses sizeof(IntPtr) as its size, despite length being defined as 4-bit integer.

Fixes #34375.

The c# side allocation of BSTRs incorrectly uses sizeof(IntPtr) as its size, despite length being defined as 4-bit integer.
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Oct 28, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Oct 28, 2025
@MrSoup678
Copy link
Author

The "defect" seems to be a gotcha of how BSTRs actually work. The size field actually uses sizeof(IntPtr) as its length.
Closing as already existing code is sound.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates that the PR has been added by a community member needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CoreCLR tests on Mono runtime : crash running Interop/StringMarshalling/BSTR/BSTRTest/BSTRTest.sh

1 participant