Skip to content

Commit cd6c183

Browse files
authored
Fix PhoneAuthOptions Timeout overflow on some platforms (#1360)
Explicitly cast PhoneAuthOptions' timeout to jlong before passing it to the JNI long constructor
1 parent 9723100 commit cd6c183

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

auth/src/android/credential_android.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ void PhoneAuthProvider::VerifyPhoneNumber(
955955
jobject timeout = env->NewObject(
956956
util::long_class::GetClass(),
957957
util::long_class::GetMethodId(util::long_class::kConstructor),
958-
options.timeout_milliseconds);
958+
static_cast<jlong>(options.timeout_milliseconds));
959959
if (util::CheckAndClearJniExceptions(env)) {
960960
listener->OnVerificationFailed(
961961
"VerifyPhoneNumber: couldn't convert timeout to java.lang.Long.");
@@ -988,7 +988,7 @@ void PhoneAuthProvider::VerifyPhoneNumber(
988988
if (util::CheckAndClearJniExceptions(env)) {
989989
env->DeleteLocalRef(builder);
990990
listener->OnVerificationFailed(
991-
"VerifyPhoneNumber: builder faild to create PhoneAuhtOptions");
991+
"VerifyPhoneNumber: builder failed to create PhoneAuthOptions");
992992
return;
993993
}
994994
env->DeleteLocalRef(builder);
@@ -1003,7 +1003,7 @@ void PhoneAuthProvider::VerifyPhoneNumber(
10031003
// If an error occurred with the call to verifyPhoneNumber, inform the
10041004
// listener that it failed.
10051005
listener->OnVerificationFailed(
1006-
"VerifyPhoneNumber: Android to verify the given phone number");
1006+
"VerifyPhoneNumber: Android failed to verify the given phone number");
10071007
}
10081008

10091009
env->DeleteLocalRef(phone_auth_options);

release_build_files/readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,11 @@ workflow use only during the development of your app, not for publicly shipping
627627
code.
628628

629629
## Release Notes
630+
### Upcoming Release
631+
- Changes
632+
- Auth (Android): Fixed an issue where VerifyPhoneNumber's internal
633+
builder failed to create PhoneAuthOptions with certain compiler settings.
634+
630635
### 11.2.0
631636
- Changes
632637
- General (Android): Update to Firebase Android BoM version 32.1.1.

0 commit comments

Comments
 (0)