Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If manifest contains service/activity with attribute "exported" of type "TYPE_REFERENCE" redex will not find the actual value #368

Open
baltrus1 opened this issue Jan 31, 2019 · 2 comments
Labels

Comments

@baltrus1
Copy link

baltrus1 commented Jan 31, 2019

Manifest contains:

<service android:exported="@bool/some_bool" android:name="some_name" android:process=":search">

and inside resources.arsc there is:

<bool name="some_bool">false</bool>

In file RedexResources.cpp function get_bool_attribute_value() redex asserts read value to be TYPE_INT_BOOLEAN instead of checking the value it references in case its TYPE_REFERENCE.

@baltrus1 baltrus1 reopened this Jan 31, 2019
@wsanville
Copy link
Contributor

Sorry for the very delayed response on this one. Thanks for the good quality report, we didn't consider that the manifest would contain references like this.

We could probably scan for all possible values of a boolean reference across all configurations and see if the value matches, then operate off that. But, I wonder what we'd do if the value varied on a configuration (does Android even let you vary android:exported based on something like dpi? that would be weird but I guess it could work). Maybe we'd have to provide a fallback option, or outright ban this case with an assert. Will take a look.

@wsanville
Copy link
Contributor

After making a test case for this, I realized there is actually 1 valid corner case where you could have android:exported="@bool/some_bool" such that some_bool is actually unknowable at compile time. Varying this value by API level is an acceptable thing to do (i.e. make some_bool false by default and make it true in values-v21 or whatever).

I'll propose we change ComponentTagInfo.is_exported to be boost::optional<boolean>for all cases when the attribute value is TYPE_REFERENCE, and any optimization that checks is_exported will need to do something sensible in the unknowable case.

facebook-github-bot pushed a commit that referenced this issue Apr 15, 2019
Summary:
I'm going to bootcamp T39834130, but before doing so I'd like to supply the person who picks up the task with an example input for test cases.

As stated on #368, we don't correctly parse the AndroidManifest.xml in all cases if a boolean literal isn't supplied for the `android:exported` attribute.

Reviewed By: newobj

Differential Revision: D14899052

fbshipit-source-id: a88829971e922b007015216e5bf372fcb6be166a
@NTillmann NTillmann added the bug label Aug 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants