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

Commit c90f4c7c authored by Yuvraj Pasi's avatar Yuvraj Pasi
Browse files

camera: check Intent entry count before reading it

In case when find() returns empty entry, blindly
reading the entry will cause segfault

Change-Id: Ib5be7fd855c409ba3b45f0d43e15237367172817
parent 4f53fe74
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1750,6 +1750,9 @@ status_t Parameters::updateRequest(CameraMetadata *request) const {

    camera_metadata_entry_t intent =
            request->find(ANDROID_CONTROL_CAPTURE_INTENT);

    if (intent.count == 0) return BAD_VALUE;

    if (intent.data.u8[0] == ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE) {
        res = request->update(ANDROID_CONTROL_AE_TARGET_FPS_RANGE,
                fastInfo.bestStillCaptureFpsRange, 2);