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

Commit e267dc89 authored by Ady Abraham's avatar Ady Abraham
Browse files

SF: add boundary check for active config

Make sure that the config specific in backdoor is valid before
calling setActiveConfig.

Bug: 162057236
Test: adb shell service call SurfaceFlinger 1035 i32 100
Change-Id: Icc6e47872cb558e638b54c16779cff6dacdc063f
parent 60a04cae
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -5323,7 +5323,8 @@ status_t SurfaceFlinger::onTransact(uint32_t code, const Parcel& data, Parcel* r
            case 1035: {
            case 1035: {
                n = data.readInt32();
                n = data.readInt32();
                mDebugDisplayConfigSetByBackdoor = false;
                mDebugDisplayConfigSetByBackdoor = false;
                if (n >= 0) {
                const auto numConfigs = mRefreshRateConfigs->getAllRefreshRates().size();
                if (n >= 0 && n < numConfigs) {
                    const auto displayToken = getInternalDisplayToken();
                    const auto displayToken = getInternalDisplayToken();
                    status_t result = setActiveConfig(displayToken, n);
                    status_t result = setActiveConfig(displayToken, n);
                    if (result != NO_ERROR) {
                    if (result != NO_ERROR) {