Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3853)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java

Issue 2392763002: Sanitize unparcable intents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
index bcb8430a9f46ba026e6e3e6e2ba056d101206aa9..dab45b5b0871e725cee5ec59cc9b13f253932bd1 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
@@ -611,9 +611,13 @@ public class IntentHandler {
*
* To track page load time, this needs to be called as close as possible to
* the entry point (in {@link Activity#onCreate()} for instance).
+ *
+ * In case the passed intent cannot be unmarshelled, this will return a sanitized intent.
+ *
+ * @return the sanitized intent including the extra timestamp
*/
- public static void addTimestampToIntent(Intent intent) {
- intent.putExtra(EXTRA_TIMESTAMP_MS, SystemClock.elapsedRealtime());
+ public static Intent addTimestampToIntent(Intent intent) {
+ return IntentUtils.safePutExtra(intent, EXTRA_TIMESTAMP_MS, SystemClock.elapsedRealtime());
}
/**

Powered by Google App Engine
This is Rietveld 408576698