Commit 41cf1c33 authored by Maggie Cai's avatar Maggie Cai Committed by Commit Bot

[IntentHandling] Fix crash in FiltersHaveOverlap.

This CL adds a check to avoid potential crash in FiltersHaveOverlap.
The possible reason for this crash is that in M88, we briefly turned on
the kIntentHandlingSharing flag, which result in a upgrade in the
PreferredApp file format. After turning off the flag, the PreferredApp
file is still upgrated, which result in comparing two intent filters
with different number of conditions (one with action, the other
without), which causes crash in the for loop. However this fix is
actually not the best fix, because after turning on the flag again,
there will be residual preferred app entries that will not be clean up
in users PreferredApps file. The best fix is to downgrade the preferred
app list when we found out the file version and the flag status does not
match.

BUG=1148617

Change-Id: I9d96691d663aa7603c8f37e6d1820b08aa9ef7d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536666
Commit-Queue: Maggie Cai <mxcai@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827689}
parent e4b170f4
...@@ -113,6 +113,9 @@ int GetFilterMatchLevel(const apps::mojom::IntentFilterPtr& intent_filter) { ...@@ -113,6 +113,9 @@ int GetFilterMatchLevel(const apps::mojom::IntentFilterPtr& intent_filter) {
bool FiltersHaveOverlap(const apps::mojom::IntentFilterPtr& filter1, bool FiltersHaveOverlap(const apps::mojom::IntentFilterPtr& filter1,
const apps::mojom::IntentFilterPtr& filter2) { const apps::mojom::IntentFilterPtr& filter2) {
if (filter1->conditions.size() != filter2->conditions.size()) {
return false;
}
if (GetFilterMatchLevel(filter1) != GetFilterMatchLevel(filter2)) { if (GetFilterMatchLevel(filter1) != GetFilterMatchLevel(filter2)) {
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment