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:
xiaozhou233 committed 2026-08-18 16:51:21 +08:00
1 parent 18a923373b
commit ff216aabee
4 files changed
+10 -1

No files matched your search

@@ -53,7 +53,8 @@ private:
void onClassFileLoadHook(const EventClassFileLoadHook& e) {
if (!e.name || !e.jni_env || !e.jvmti_env ||
!e.classbytes || e.class_data_len <= 0) {
!e.classbytes || e.class_data_len <= 0 ||
!e.new_class_data_len || !e.new_classbytes) {
return;
}