https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a58b713a5e32a8ca23f4e514aad65c8b0c1e8c30
commit a58b713a5e32a8ca23f4e514aad65c8b0c1e8c30 Author: Timo Kreuzer <timo.kreu...@reactos.org> AuthorDate: Sun Nov 10 16:01:21 2024 +0200 Commit: Timo Kreuzer <timo.kreu...@reactos.org> CommitDate: Wed Jan 22 18:56:08 2025 +0200 [UCRT] Properly implement __crt_fast_encode/decode_pointer --- sdk/lib/ucrt/inc/internal_shared.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sdk/lib/ucrt/inc/internal_shared.h b/sdk/lib/ucrt/inc/internal_shared.h index 08c1cb79463..7ad4b4bafe3 100644 --- a/sdk/lib/ucrt/inc/internal_shared.h +++ b/sdk/lib/ucrt/inc/internal_shared.h @@ -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>