https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2d753d95fbdc03339c2241ff8c14b76d57637699

commit 2d753d95fbdc03339c2241ff8c14b76d57637699
Author:     Timo Kreuzer <timo.kreu...@reactos.org>
AuthorDate: Sun Oct 13 19:36:53 2024 +0200
Commit:     Timo Kreuzer <timo.kreu...@reactos.org>
CommitDate: Thu Jan 16 14:18:53 2025 +0200

    [UCRT] Fix multiple missing dereferences
    
    This is a bug in MS UCRT code. MSVC allows to check a pointer to be > 0, 
GCC emits a warning.
---
 sdk/lib/ucrt/locale/initctype.cpp | 2 +-
 sdk/lib/ucrt/locale/initmon.cpp   | 2 +-
 sdk/lib/ucrt/locale/initnum.cpp   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sdk/lib/ucrt/locale/initctype.cpp 
b/sdk/lib/ucrt/locale/initctype.cpp
index d4fc2cefb1f..c2a4f65b5dc 100644
--- a/sdk/lib/ucrt/locale/initctype.cpp
+++ b/sdk/lib/ucrt/locale/initctype.cpp
@@ -251,7 +251,7 @@ error_cleanup:
         if ( (ploci->ctype1_refcount != nullptr)&&
              (InterlockedDecrement(ploci->ctype1_refcount) == 0))
         {
-            _ASSERTE(ploci->ctype1_refcount > 0);
+            _ASSERTE(*ploci->ctype1_refcount > 0);
         }
         ploci->ctype1_refcount        = nullptr;
         ploci->ctype1                 = nullptr;
diff --git a/sdk/lib/ucrt/locale/initmon.cpp b/sdk/lib/ucrt/locale/initmon.cpp
index 0525bc744a1..4cdfc0afa71 100644
--- a/sdk/lib/ucrt/locale/initmon.cpp
+++ b/sdk/lib/ucrt/locale/initmon.cpp
@@ -205,7 +205,7 @@ int __cdecl __acrt_locale_initialize_monetary (
     if ( (ploci->lconv_mon_refcount != nullptr) &&
          (InterlockedDecrement(ploci->lconv_mon_refcount) == 0))
     {
-        _ASSERTE(ploci->lconv_mon_refcount > 0);
+        _ASSERTE(*ploci->lconv_mon_refcount > 0);
     }
     if ( (ploci->lconv_intl_refcount != nullptr) &&
          (InterlockedDecrement(ploci->lconv_intl_refcount) == 0))
diff --git a/sdk/lib/ucrt/locale/initnum.cpp b/sdk/lib/ucrt/locale/initnum.cpp
index e37fe69c298..801e3d935dd 100644
--- a/sdk/lib/ucrt/locale/initnum.cpp
+++ b/sdk/lib/ucrt/locale/initnum.cpp
@@ -187,7 +187,7 @@ int __cdecl __acrt_locale_initialize_numeric (
     if ( (ploci->lconv_num_refcount != nullptr) &&
          (InterlockedDecrement(ploci->lconv_num_refcount) == 0))
     {
-        _ASSERTE(ploci->lconv_num_refcount > 0);
+        _ASSERTE(*ploci->lconv_num_refcount > 0);
     }
     if ( (ploci->lconv_intl_refcount != nullptr) &&
          (InterlockedDecrement(ploci->lconv_intl_refcount) == 0))

Reply via email to