mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 21:15:56 +08:00
Fix: harden remapper filters and agent init guard
- skip empty include/exclude entries in Remapper::shouldRemap to avoid calling back() on an empty std::string (undefined behavior) - null-check new_class_data_len/new_classbytes in JuiceRemapperService before writing remapped bytes back to the JVMTI callback - add Agent::initialized_ guard so init() is a no-op on second call, preventing duplicate service instantiation and listeners
This commit is contained in:
1 parent
18a923373b
commit
ff216aabee
4 files changed
+10
-1
No files matched your search
@@ -13,6 +13,7 @@ namespace JuiceAgent {
|
||||
JuiceAgent::Config::Config config;
|
||||
|
||||
bool loaded = false;
|
||||
bool initialized_ = false;
|
||||
public:
|
||||
// Singleton
|
||||
static Agent& getInstance();
|
||||
|
||||
@@ -198,6 +198,7 @@ public:
|
||||
std::lock_guard<std::mutex> lock(filterMutex_);
|
||||
|
||||
for (const auto& exc : excludes_) {
|
||||
if (exc.empty()) continue;
|
||||
if (name == exc) return false;
|
||||
if (exc.back() == '/' && name.rfind(exc, 0) == 0) return false;
|
||||
if (name.size() > exc.size() &&
|
||||
@@ -205,6 +206,7 @@ public:
|
||||
}
|
||||
|
||||
for (const auto& inc : includes_) {
|
||||
if (inc.empty()) continue;
|
||||
if (name == inc) return true;
|
||||
if (inc.back() == '/' && name.rfind(inc, 0) == 0) return true;
|
||||
if (name.size() > inc.size() &&
|
||||
|
||||
Reference in new issue
Block a user