Merge change 1370 into donut
* changes: Fix a JNI layer crash due to null camera object passed to get_native_camera() The fix will check on the camera object and if it is a null object, we throw a NullPointerException; application layer should also avoid passing a null java object to MediaRecorder.setCamera().
This commit is contained in:
@@ -150,6 +150,11 @@ static sp<MediaRecorder> setMediaRecorder(JNIEnv* env, jobject thiz, const sp<Me
|
|||||||
|
|
||||||
static void android_media_MediaRecorder_setCamera(JNIEnv* env, jobject thiz, jobject camera)
|
static void android_media_MediaRecorder_setCamera(JNIEnv* env, jobject thiz, jobject camera)
|
||||||
{
|
{
|
||||||
|
// we should not pass a null camera to get_native_camera() call.
|
||||||
|
if (camera == NULL) {
|
||||||
|
jniThrowException(env, "java/lang/NullPointerException", "camera object is a NULL pointer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
sp<Camera> c = get_native_camera(env, camera, NULL);
|
sp<Camera> c = get_native_camera(env, camera, NULL);
|
||||||
sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
|
sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
|
||||||
process_media_recorder_call(env, mr->setCamera(c->remote()),
|
process_media_recorder_call(env, mr->setCamera(c->remote()),
|
||||||
|
|||||||
Reference in New Issue
Block a user