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

Commit 435fd2fd authored by Ady Abraham's avatar Ady Abraham
Browse files

composer: fix null pointer dereference

The test process was crashing on null pointer instead of exiting
successfully, so fixing the null pointer error.

Test: VTS
Change-Id: I1d6988d25ed58c159adc49d43d36e4b3f0ffa289
parent 80b5caec
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -419,7 +419,8 @@ TEST_P(GraphicsCompositionTest, SetReadbackBufferBadParameter) {
        return;
    }

    aidl::android::hardware::common::NativeHandle bufferHandle = ::android::dupToAidl(nullptr);
    aidl::android::hardware::common::NativeHandle bufferHandle =
            ::android::dupToAidl(mGraphicBuffer->handle);
    ndk::ScopedFileDescriptor releaseFence = ndk::ScopedFileDescriptor(-1);
    const auto error =
            mComposerClient->setReadbackBuffer(mPrimaryDisplay, bufferHandle, releaseFence);
+4 −4
Original line number Diff line number Diff line
@@ -242,13 +242,13 @@ void ReadbackBuffer::checkReadbackBuffer(std::vector<Color> expectedColors) {

    int outBytesPerPixel;
    int outBytesPerStride;
    auto status = mGraphicBuffer->lockAsync(mUsage, mAccessRegion, nullptr, fenceHandle.get(),
    void* bufData = nullptr;
    auto status = mGraphicBuffer->lockAsync(mUsage, mAccessRegion, &bufData, fenceHandle.get(),
                                            &outBytesPerPixel, &outBytesPerStride);
    EXPECT_EQ(::android::OK, status);
    ASSERT_TRUE(mPixelFormat == PixelFormat::RGB_888 || mPixelFormat == PixelFormat::RGBA_8888);
    ReadbackHelper::compareColorBuffers(expectedColors, mGraphicBuffer.get(),
                                        static_cast<int32_t>(mStride), mWidth, mHeight,
                                        mPixelFormat);
    ReadbackHelper::compareColorBuffers(expectedColors, bufData, static_cast<int32_t>(mStride),
                                        mWidth, mHeight, mPixelFormat);
    status = mGraphicBuffer->unlock();
    EXPECT_EQ(::android::OK, status);
}