From 396d75aaf31de9c17cdc655118006ec28ad3856a Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Mon, 17 May 2021 13:15:33 -0400 Subject: [PATCH 1/4] Fix GetPlatformAppByName() to actually check the result of jni_env->ExceptionCheck() and return NULL if an exception was thrown. --- app/src/app_android.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/app_android.cc b/app/src/app_android.cc index 3f7c9beaa5..ecd4f27c14 100644 --- a/app/src/app_android.cc +++ b/app/src/app_android.cc @@ -311,7 +311,13 @@ static jobject GetPlatformAppByName(JNIEnv* jni_env, const char* name) { name_string); jni_env->DeleteLocalRef(name_string); } - jni_env->ExceptionCheck(); + if (jni_env->ExceptionCheck()) { + // Explicitly set `platform_app` to `NULL` if an exception was thrown + // because on KitKat (API 19) `CallStaticObjectMethod()` may return garbage + // instead of `NULL` if an exception was thrown, and callers of this + // function expect `NULL` to be returned if the app was not found. + platform_app = NULL; // NOLINT + } jni_env->ExceptionClear(); return platform_app; } From 4984f0916de2b0b9aa626942f4db60dfd5aa75c8 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Mon, 17 May 2021 14:26:08 -0400 Subject: [PATCH 2/4] Add release notes --- release_build_files/readme.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/release_build_files/readme.md b/release_build_files/readme.md index d34e72e0c1..e724e95efd 100644 --- a/release_build_files/readme.md +++ b/release_build_files/readme.md @@ -378,7 +378,10 @@ code. API. - Remote Config(Android): Fix for getting Remote Config instance for a specific app object. - ([#991](https://github.com/firebase/quickstart-unity/issues/991). + ([#991](https://github.com/firebase/quickstart-unity/issues/991)). + - General (Android): Fixed a potential SIGABRT when a non-default app name + was created on KitKat + ([#429](https://github.com/firebase/firebase-cpp-sdk/pull/429)). ### 7.3.0 - Changes From d762ce6110f491e58e65b3f154b690684fae6334 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Mon, 17 May 2021 15:21:44 -0400 Subject: [PATCH 3/4] Fix a typo in release_build_files/readme.md --- release_build_files/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release_build_files/readme.md b/release_build_files/readme.md index e724e95efd..c270ca11f6 100644 --- a/release_build_files/readme.md +++ b/release_build_files/readme.md @@ -379,8 +379,8 @@ code. - Remote Config(Android): Fix for getting Remote Config instance for a specific app object. ([#991](https://github.com/firebase/quickstart-unity/issues/991)). - - General (Android): Fixed a potential SIGABRT when a non-default app name - was created on KitKat + - General (Android): Fixed a potential SIGABRT when an app was created + with non-default app name on Android KitKat ([#429](https://github.com/firebase/firebase-cpp-sdk/pull/429)). ### 7.3.0 From 391acc53b34b26b61e528d2caa3e18622d0d44ef Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Mon, 17 May 2021 15:22:31 -0400 Subject: [PATCH 4/4] Fix a typo in the typo fix --- release_build_files/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release_build_files/readme.md b/release_build_files/readme.md index c270ca11f6..c13841e8ad 100644 --- a/release_build_files/readme.md +++ b/release_build_files/readme.md @@ -380,7 +380,7 @@ code. specific app object. ([#991](https://github.com/firebase/quickstart-unity/issues/991)). - General (Android): Fixed a potential SIGABRT when an app was created - with non-default app name on Android KitKat + with a non-default app name on Android KitKat ([#429](https://github.com/firebase/firebase-cpp-sdk/pull/429)). ### 7.3.0