-
Couldn't load subscription status.
- Fork 5.2k
Closed
Labels
area-System.DirectoryServicesin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Description
Description
On Big Endian architectures (s390x), the test:
The LdapSessionOptions.ProtocolVersion property in System.DirectoryServices.Protocols throws an OverflowException on Big Endian architectures (e.g., s390x).
This happens because IntPtr.ToInt32() assumes Little Endian memory layout, but on Big Endian, the upper 32 bits are nonzero, leading to overflow.
Reproduction Steps
Environment
- Architecture:
s390x(Big Endian) - OS: Linux (RHEL 9.4, Ubuntu)
- .NET Version:
10.0.100-alpha.1
Steps to Reproduce
- Run:
dotnet test --filter "FullyQualifiedName=System.DirectoryServices.Protocols.Tests.LdapSessionOptionsTests.ProtocolVersion_Set_GetReturnsExpected"
The test fails with an OverflowException
Expected behavior
ProtocolVersionshould correctly retrieve and set the integer version of LDAP across all architectures.- On Big Endian (s390x), it should properly interpret the integer value stored in the pointer instead of causing an
OverflowException.
Actual behavior
- The test fails with an
OverflowExceptiondue to incorrect conversion of theIntPtron Big Endian.
This happens because:
- GetPtrValueHelper(LdapOption.LDAP_OPT_VERSION) returns an IntPtr.
- ToInt32() incorrectly interprets it without adjusting for endianness.
- This works fine on Little Endian (x86, ARM64), but fails on Big Endian (s390x).
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
- This bug affects Big Endian architectures (s390x).
- The error is not reproducible on x86/x64 due to their Little Endian layout.
- Fixing this ensures that LDAP-based authentication works correctly on IBM mainframes and other Big Endian platforms.
Metadata
Metadata
Assignees
Labels
area-System.DirectoryServicesin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged