[UCRT] Properly implement __crt_fast_encode/decode_pointer

This commit is contained in:
Timo Kreuzer 2024-11-10 16:01:21 +02:00
parent c1145f0c89
commit a58b713a5e

View file

@ -166,18 +166,20 @@ extern char __ImageBase;
template<typename T>
__forceinline
T __crt_fast_encode_pointer(T Ptr)
T __crt_fast_encode_pointer(T ptr)
{
// FIXME: use cookie
return Ptr;
union { T Ptr; uintptr_t Uint; } u = { ptr };
u.Uint ^= __security_cookie;
return u.Ptr;
}
template<typename T>
__forceinline
T __crt_fast_decode_pointer(T Ptr)
T __crt_fast_decode_pointer(T ptr)
{
// FIXME: use cookie
return Ptr;
union { T Ptr; uintptr_t Uint; } u = { ptr };
u.Uint ^= __security_cookie;
return u.Ptr;
}
template<typename T>