Skip to content

Remote Config (Android): pass blob.data() to Variant::FromMutableBlob - #1993

Merged
AustinBenoit merged 3 commits into
mainfrom
fix/remote-config-android-blob-variant
Dec 1, 2026
Merged

AustinBenoit merged 3 commits into
mainfrom
fix/remote-config-android-blob-variant

Conversation

@AustinBenoit

Copy link
Copy Markdown
Contributor

Description

In RemoteConfigValueToVariant() (remote_config/src/android/remote_config_android.cc), the byte-array conversion branch passed &blob (the address of the local std::vector<unsigned char> object on the stack) instead of blob.data() to Variant::FromMutableBlob(). Pass blob.data() so Variant::FromMutableBlob() copies from the vector's underlying byte buffer rather than reading stack memory of the std::vector object.


Testing

  • Built :remote_config:assembleRelease via Gradle across arm64-v8a, armeabi-v7a, x86, and x86_64 — passed.
  • Verified python3 scripts/format_code.py -git_diff and ./scripts/gha/check_copyright.sh -g.

Type of Change

Place an x the applicable box:

  • Bug fix.
  • New feature. A non-breaking change which adds functionality.
  • Other, such as a build process or documentation change.

In RemoteConfigValueToVariant(), the byte-array conversion branch passed &blob (the address of the local std::vector<unsigned char> object on the stack) instead of blob.data() to Variant::FromMutableBlob(), causing an out-of-bounds stack read for payloads larger than sizeof(blob) and corrupting returned binary Variant values in GetAll().

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request fixes an out-of-bounds stack read in the Android Remote Config implementation. In remote_config_android.cc, the code was incorrectly passing the address of the std::vector container (&blob) instead of the pointer to its underlying data (blob.data()) to Variant::FromMutableBlob. This has been corrected to use blob.data(). The release notes in readme.md have also been updated to reflect this fix. There are no review comments, and I have no feedback to provide.

@AustinBenoit
AustinBenoit enabled auto-merge (squash) December 1, 2026 15:06
@@ -1292,7 +1292,7 @@ static Variant RemoteConfigValueToVariant(JNIEnv* env, jobject from) {
if (!CheckKeyRetrievalLogError(env, "", "vector")) {
std::vector<unsigned char> blob =

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Lint warning: Add #include <vector> for vector<>

@AustinBenoit
AustinBenoit merged commit 0d498b7 into main Dec 1, 2026
39 checks passed
@github-actions github-actions Bot added the tests: in-progress This PR's integration tests are in progress. label Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

✅  Integration test succeeded!

Requested by @AustinBenoit on commit 0d498b7
Last updated: Tue Dec 1 08:29 PST 2026
View integration test log & download artifacts

@github-actions github-actions Bot added the tests: succeeded This PR's integration tests succeeded. label Dec 1, 2026
@firebase-workflow-trigger firebase-workflow-trigger Bot removed the tests: in-progress This PR's integration tests are in progress. label Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests: succeeded This PR's integration tests succeeded.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants