diff options
author | Petr Bred <bredpetr@gmail.com> | 2017-10-31 19:57:57 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2017-10-31 19:57:57 +0300 |
commit | d4de23676852426f0aa1637aa501b9309441392c (patch) | |
tree | 10e1a075422843f8221b3e2c5316d68dc4c709bc /src/Runtime.Base | |
parent | 9f0b6bfce567b6ffecfd1dcfc1e9a2ebd694009a (diff) |
ARM32: fix IntPtr overflow issues with thunk addresses (#4846)
- thunk addresses can be wider than type Int,
but valid in C pointers terms.
Signed-off-by: Petr Bred <bredpetr@gmail.com>
Diffstat (limited to 'src/Runtime.Base')
-rw-r--r-- | src/Runtime.Base/src/System/Runtime/ThunkPool.cs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Runtime.Base/src/System/Runtime/ThunkPool.cs b/src/Runtime.Base/src/System/Runtime/ThunkPool.cs index 73f25d157..404494451 100644 --- a/src/Runtime.Base/src/System/Runtime/ThunkPool.cs +++ b/src/Runtime.Base/src/System/Runtime/ThunkPool.cs @@ -81,16 +81,16 @@ namespace System.Runtime private static IntPtr ClearThumbBit(IntPtr value) { #if ARM - Debug.Assert(((nuint)value & 1) == 1); - value = (IntPtr)((nuint)value - 1); + Debug.Assert(((nint)value & 1) == 1); + value = (IntPtr)((nint)value - 1); #endif return value; } private static IntPtr SetThumbBit(IntPtr value) { #if ARM - Debug.Assert(((nuint)value & 1) == 0); - value = (IntPtr)((nuint)value + 1); + Debug.Assert(((nint)value & 1) == 0); + value = (IntPtr)((nint)value + 1); #endif return value; } @@ -296,7 +296,7 @@ namespace System.Runtime int thunkIndex = (int)((thunkAddressValue - currentThunksBlockAddress) / (nuint)Constants.ThunkCodeSize); // Compute the address of the data block that corresponds to the current thunk - IntPtr thunkDataBlockAddress = InternalCalls.RhpGetThunkDataBlockAddress((IntPtr)thunkAddressValue); + IntPtr thunkDataBlockAddress = InternalCalls.RhpGetThunkDataBlockAddress((IntPtr)((nint)thunkAddressValue)); return thunkDataBlockAddress + thunkIndex * Constants.ThunkDataSize; } |