From e992e75053e98e3699af6e344c11b787e30411ad Mon Sep 17 00:00:00 2001 From: Eino-Ville Talvala Date: Fri, 7 Nov 2014 16:17:48 -0800 Subject: Camera: Guard against asBinder() calls on NULL interfaces Bug: 18207548 Change-Id: I9879c9b4c0282a6b96b77398f62beedc47f7f0a0 --- services/camera/libcameraservice/api1/Camera2Client.cpp | 3 ++- services/camera/libcameraservice/api1/CameraClient.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'services/camera/libcameraservice/api1') diff --git a/services/camera/libcameraservice/api1/Camera2Client.cpp b/services/camera/libcameraservice/api1/Camera2Client.cpp index 2a6aa7b..dd2f64d 100644 --- a/services/camera/libcameraservice/api1/Camera2Client.cpp +++ b/services/camera/libcameraservice/api1/Camera2Client.cpp @@ -165,7 +165,8 @@ status_t Camera2Client::dump(int fd, const Vector& args) { String8 result; result.appendFormat("Client2[%d] (%p) Client: %s PID: %d, dump:\n", mCameraId, - getRemoteCallback()->asBinder().get(), + (getRemoteCallback() != NULL ? + getRemoteCallback()->asBinder().get() : NULL), String8(mClientPackageName).string(), mClientPid); result.append(" State: "); diff --git a/services/camera/libcameraservice/api1/CameraClient.cpp b/services/camera/libcameraservice/api1/CameraClient.cpp index 1a4d9a6..2b17028 100644 --- a/services/camera/libcameraservice/api1/CameraClient.cpp +++ b/services/camera/libcameraservice/api1/CameraClient.cpp @@ -118,7 +118,8 @@ status_t CameraClient::dump(int fd, const Vector& args) { size_t len = snprintf(buffer, SIZE, "Client[%d] (%p) PID: %d\n", mCameraId, - getRemoteCallback()->asBinder().get(), + (getRemoteCallback() != NULL ? + getRemoteCallback()->asBinder().get() : NULL), mClientPid); len = (len > SIZE - 1) ? SIZE - 1 : len; write(fd, buffer, len); -- cgit v1.1