File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,8 +45,9 @@ lm_address_t MemHlp::patternScan(const char* pattern, lm_module_t module)
4545 // Totally unnecessary right now, and might always be
4646
4747 static auto codeSections = std::map<lm_address_t , lm_address_t >();
48+ codeSections.clear ();
4849
49- const static auto lambda = [](lm_segment_t * seg, lm_void_t * arg) -> lm_bool_t
50+ const static auto enumSections = [](lm_segment_t * seg, lm_void_t * arg) -> lm_bool_t
5051 {
5152 if (seg->prot & LM_PROT_R)
5253 {
@@ -57,10 +58,19 @@ lm_address_t MemHlp::patternScan(const char* pattern, lm_module_t module)
5758 return LM_TRUE;
5859 };
5960
60- LM_EnumSegments (lambda , nullptr );
61+ LM_EnumSegments (enumSections , nullptr );
6162
6263 for (const auto & itm : codeSections)
6364 {
65+ if (module .base > itm.second )
66+ {
67+ continue ;
68+ }
69+ if (module .base + module .size < itm.first )
70+ {
71+ continue ;
72+ }
73+
6474 for (lm_address_t cur = itm.first ; cur < itm.second ; cur++)
6575 {
6676 bool found = true ;
You can’t perform that action at this time.
0 commit comments