From d20d6ea5514aa9bf0d2d2fb3208e278701c42dd9 Mon Sep 17 00:00:00 2001 From: Abdullah Ahmed <92085834+abd-770@users.noreply.github.com> Date: Thu, 15 Aug 2024 13:50:53 +0530 Subject: [PATCH] fix: Functional-notation casting vulnerability fix (#35252) Fix for issue: https://github.com/milvus-io/milvus/issues/35200 --- .../core/src/bitset/detail/platform/x86/instruction_set.cpp | 4 ++-- internal/core/src/common/EasyAssert.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/core/src/bitset/detail/platform/x86/instruction_set.cpp b/internal/core/src/bitset/detail/platform/x86/instruction_set.cpp index 329dc4243c..71a574bf80 100644 --- a/internal/core/src/bitset/detail/platform/x86/instruction_set.cpp +++ b/internal/core/src/bitset/detail/platform/x86/instruction_set.cpp @@ -90,13 +90,13 @@ InstructionSet::InstructionSet() } // load bitset with flags for function 0x80000001 - if (nExIds_ >= (int)0x80000001) { + if (nExIds_ >= static_cast(0x80000001)) { f_81_ECX_ = extdata_[1][2]; f_81_EDX_ = extdata_[1][3]; } // Interpret CPU brand string if reported - if (nExIds_ >= (int)0x80000004) { + if (nExIds_ >= static_cast(0x80000004)) { memcpy(brand, extdata_[2].data(), sizeof(cpui)); memcpy(brand + 16, extdata_[3].data(), sizeof(cpui)); memcpy(brand + 32, extdata_[4].data(), sizeof(cpui)); diff --git a/internal/core/src/common/EasyAssert.h b/internal/core/src/common/EasyAssert.h index e101301639..8458d17e01 100644 --- a/internal/core/src/common/EasyAssert.h +++ b/internal/core/src/common/EasyAssert.h @@ -130,7 +130,7 @@ FailureCStatus(const std::exception* ex) { #define AssertInfo(expr, info, args...) \ do { \ - auto _expr_res = bool(expr); \ + auto _expr_res = static_cast(expr); \ /* call func only when needed */ \ if (!_expr_res) { \ milvus::impl::EasyAssertInfo(_expr_res, \