From 919274abeb189a33e35533825aa0071b1c7e2bc1 Mon Sep 17 00:00:00 2001 From: Michael W Date: Sat, 4 Jun 2016 16:44:23 +0200 Subject: InCallUI: Fix possible OOBs At least rejectCallWithMessage seems to get called with phoneId being -1, resulting in an OOB Fix that case on other places as well Reference: BugDump 20160527-0602 L#163 Change-Id: I65ae5bc439ef9a4d4f435369e1c41abe110e02b6 --- src/com/android/incallui/AnswerPresenter.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/com/android/incallui/AnswerPresenter.java b/src/com/android/incallui/AnswerPresenter.java index 020d075d..d69d7c7d 100644 --- a/src/com/android/incallui/AnswerPresenter.java +++ b/src/com/android/incallui/AnswerPresenter.java @@ -446,6 +446,10 @@ public class AnswerPresenter extends Presenter public void onDecline(Context context) { int phoneId = getActivePhoneId(); Log.d(this, "onDecline mCallId:" + mCallId + "phoneId:" + phoneId); + if (phoneId == -1) { + return; + } + if (mCall[phoneId].getSessionModificationState() == Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) { InCallPresenter.getInstance().declineUpgradeRequest(context); @@ -476,6 +480,10 @@ public class AnswerPresenter extends Presenter public void onBlockDialogInitialize() { int phoneId = getActivePhoneId(); Log.d(this, "onBlock mCallId:" + mCallId + "phoneId:" + phoneId); + if (phoneId == -1) { + return; + } + Call call = mCall[phoneId]; final String number = call.getNumber(); final Context context = getUi().getContext(); @@ -517,7 +525,11 @@ public class AnswerPresenter extends Presenter public void rejectCallWithMessage(String message) { int phoneId = getActivePhoneId(); - Log.i(this, "sendTextToDefaultActivity()...phoneId:" + phoneId); + Log.i(this, "rejectCallWithMessage phoneId:" + phoneId); + if (phoneId == -1) { + return; + } + TelecomAdapter.getInstance().rejectCall(mCall[phoneId].getId(), true, message); onDismissDialog(); -- cgit v1.2.3