From 69d4a277e5f04b54c8489ab72e42402912b52b15 Mon Sep 17 00:00:00 2001 From: yangbingqian Date: Wed, 22 Mar 2017 18:41:15 +0800 Subject: FATAL EXCEPTION IN SYSTEM PROCESS: android.ui when 3rd party app put an extra with a bad serial object to start a service or sendbroadcast to system_server. It will cause system_server crash because of classNotFoundException. A test demo apk will cause system_server crash. It really affact the system stability Intent intent = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); intent.putExtra(Intent.EXTRA_REFERRER, new serial() /*a Serializable class object*/); sendBroadcast(intent); Test: use the test apk attached in the issue below, system_server will crash every time. And it'll be OK with this CL. https://code.google.com/p/android/issues/detail?id=261031 Change-Id: Id505571dcbf88c0ba9c1677ec0f1f08688c1bb95 Signed-off-by: yangbingqian --- core/java/android/os/BaseBundle.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/java/android/os/BaseBundle.java b/core/java/android/os/BaseBundle.java index 1692921f4a8f..5cfdd361e67a 100644 --- a/core/java/android/os/BaseBundle.java +++ b/core/java/android/os/BaseBundle.java @@ -298,6 +298,13 @@ public class BaseBundle { } else { throw e; } + } catch (RuntimeException e) { + if (sShouldDefuse && (e.getCause() instanceof ClassNotFoundException)) { + Log.w(TAG, "Failed to parse Bundle, but defusing quietly", e); + map.erase(); + } else { + throw e; + } } finally { mMap = map; if (recycleParcel) { -- cgit v1.2.3