Skip to content

Commit 104f773

Browse files
committed
fix: add volatile to pPatternMem
1 parent e70830a commit 104f773

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/dynlibutils/module.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ struct CCache
287287
}
288288

289289
CCache(
290-
const std::uint8_t* pPatternMem,
290+
const volatile std::uint8_t* pPatternMem,
291291
const size_t nSize,
292292
const CMemory pStartAddress = nullptr,
293293
const Section_t* pModuleSection = nullptr
@@ -439,7 +439,7 @@ class CAssemblyModule : public CMemory
439439
template<std::size_t SIZE = (s_nDefaultPatternSize - 1) / 2>
440440
inline CMemory FindPattern(const CMemoryView<std::uint8_t> pPatternMem, const std::string_view svMask, const CMemory pStartAddress, const Section_t* pModuleSection) const
441441
{
442-
const auto* pPattern = pPatternMem.RCastView();
442+
volatile const auto* pPattern = pPatternMem.RCastView();
443443

444444
CCache sKey(pPattern, svMask.size(), pStartAddress, pModuleSection);
445445
if (auto pAddr = GetAddress(sKey))
@@ -479,7 +479,7 @@ class CAssemblyModule : public CMemory
479479
for (std::size_t n = 0; n < numBlocks; ++n)
480480
{
481481
const std::size_t offset = n * kSimdBytes;
482-
patternChunks[n] = _mm_loadu_si128(reinterpret_cast<const __m128i*>(pPattern + offset));
482+
patternChunks[n] = _mm_loadu_si128(reinterpret_cast<const __m128i*>(const_cast<std::uint8_t*>(pPattern) + offset));
483483

484484
for (std::size_t j = 0; j < kSimdBytes; ++j)
485485
{

0 commit comments

Comments
 (0)