Skip to content

Commit

Permalink
Fixes crash on unexpected key messages (#972)
Browse files Browse the repository at this point in the history
  • Loading branch information
SessionHero01 authored Feb 24, 2025
1 parent 72a57cd commit 2814e35
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libsession-util/src/main/cpp/group_keys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ Java_network_loki_messenger_libsession_1util_GroupKeysConfig_loadKey(JNIEnv *env
auto hash_bytes = env->GetStringUTFChars(hash, nullptr);
auto info = reinterpret_cast<session::config::groups::Info*>(info_ptr);
auto members = reinterpret_cast<session::config::groups::Members*>(members_ptr);
bool processed = keys->load_key_message(hash_bytes, message_bytes, timestamp_ms, *info, *members);

auto processed = jni_utils::run_catching_cxx_exception_or_throws<jboolean>(env, [&] {
return keys->load_key_message(hash_bytes, message_bytes, timestamp_ms, *info, *members);
});

env->ReleaseStringUTFChars(hash, hash_bytes);
return processed;
Expand Down

0 comments on commit 2814e35

Please sign in to comment.