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

Commit 5e92144c authored by Courtney Goeltzenleuchter's avatar Courtney Goeltzenleuchter
Browse files

Fix integer overflow in libgui_test Surface_test

Integer overflow now causes abort (aosp/589659, aosp/589605), causing libgui_test to
fail one of the compositor tests.
Bug: 72229624
Test: adb shell /data/nativetest/libgui_test/libgui_test \
	--gtest_filter=GetFrameTimestampsTest.CompositorTimingUpdatesBasic
Change-Id: I91c77ba53e5ed74034884c8e144e3c3198458aa5
parent b984999c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <binder/ProcessState.h>
#include <configstore/Utils.h>
#include <cutils/properties.h>
#include <inttypes.h>
#include <gui/BufferItemConsumer.h>
#include <gui/IDisplayEventConnection.h>
#include <gui/IProducerListener.h>
@@ -869,7 +870,7 @@ protected:
                (iOldFrame == NO_FRAME_INDEX) ? nullptr : &mFrames[iOldFrame];
        FrameEvents* newFrame = &mFrames[iNewFrame];

        uint64_t nOldFrame = iOldFrame + 1;
        uint64_t nOldFrame = (iOldFrame == NO_FRAME_INDEX) ? 0 : iOldFrame + 1;
        uint64_t nNewFrame = iNewFrame + 1;

        // Latch, Composite, and Release the frames in a plausible order.