Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d527765f authored by Devendra Singhi's avatar Devendra Singhi Committed by Ayushi Khopkar
Browse files

camera_service_fuzzer: Bug Fix

Resolved Null Pointer Dereference

Test: ./camera_service_fuzzer clusterfuzz-testcase-minimized-camera_service_fuzzer-5154728196833280
Bug: 232984975

Change-Id: Ie5a0bc1bd2cd3ffae95cc6b07b03439809350a07
parent 9cdf185f
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -392,15 +392,17 @@ void CameraFuzzer::invokeCameraAPIs() {
                String8("Test Surface"), previewWidth, previewHeight,
                CameraParameters::previewFormatToEnum(params.getPreviewFormat()), layerMetaData);

        if (surfaceControl.get() != nullptr) {
        if (surfaceControl.get()) {
            SurfaceComposerClient::Transaction{}
                    .setLayer(surfaceControl, 0x7fffffff)
                    .show(surfaceControl)
                    .apply();

            previewSurface = surfaceControl->getSurface();
            if (previewSurface.get()) {
                cameraDevice->setPreviewTarget(previewSurface->getIGraphicBufferProducer());
            }
        }
        cameraDevice->setPreviewCallbackFlag(CAMERA_FRAME_CALLBACK_FLAG_CAMCORDER);

        Vector<Size> pictureSizes;
@@ -442,7 +444,20 @@ void CameraFuzzer::invokeCameraAPIs() {
            waitForPreviewStart();
            cameraDevice->setVideoBufferMode(
                    android::hardware::BnCamera::VIDEO_BUFFER_MODE_BUFFER_QUEUE);
            cameraDevice->setVideoTarget(previewSurface->getIGraphicBufferProducer());
            sp<SurfaceControl> surfaceControlVideo = mComposerClient->createSurface(
                    String8("Test Surface Video"), previewWidth, previewHeight,
                    CameraParameters::previewFormatToEnum(params.getPreviewFormat()),
                    layerMetaData);
            if (surfaceControlVideo.get()) {
                SurfaceComposerClient::Transaction{}
                        .setLayer(surfaceControlVideo, 0x7fffffff)
                        .show(surfaceControlVideo)
                        .apply();
                sp<Surface> previewSurfaceVideo = surfaceControlVideo->getSurface();
                if (previewSurfaceVideo.get()) {
                    cameraDevice->setVideoTarget(previewSurfaceVideo->getIGraphicBufferProducer());
                }
            }
            cameraDevice->stopPreview();
            cameraDevice->startRecording();
            waitForEvent(mRecordingLock, mRecordingCondition, mRecordingNotification);