Commit 902b7ec3 authored by Bernhard Bauer's avatar Bernhard Bauer Committed by Commit Bot

Catch ClassNotFoundException when sanitizing incoming intents.

Who sanitizes the sanitizers? Or something.

Bug: b/73082949
Change-Id: Ibb418338e4f762ea2a385647656114dc619cf230
Reviewed-on: https://chromium-review.googlesource.com/913211Reviewed-by: default avatarBernhard Bauer <bauerb@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Bernhard Bauer <bauerb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#536059}
parent 94863d4e
......@@ -420,6 +420,11 @@ public class IntentUtils {
}
}
private static Intent logInvalidIntent(Intent intent, Exception e) {
Log.e(TAG, "Invalid incoming intent.", e);
return intent.replaceExtras((Bundle) null);
}
/**
* Sanitizes an intent. In case the intent cannot be unparcelled, all extras will be removed to
* make it safe to use.
......@@ -431,8 +436,12 @@ public class IntentUtils {
incomingIntent.getBooleanExtra("TriggerUnparcel", false);
return incomingIntent;
} catch (BadParcelableException e) {
Log.e(TAG, "Invalid incoming intent.", e);
return incomingIntent.replaceExtras((Bundle) null);
return logInvalidIntent(incomingIntent, e);
} catch (RuntimeException e) {
if (e.getCause() instanceof ClassNotFoundException) {
return logInvalidIntent(incomingIntent, e);
}
throw e;
}
}
}
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