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

Commit a3b93a7a authored by Ramakant Singh's avatar Ramakant Singh Committed by Arne Coucheron
Browse files

surfaceflinger: Validate setposition parameters

Validate setposition parameters width and height to
fix hang issues becuase of wrong values set by clients.

Change-Id: I786fc6f986fdb1d7de46ac3845f6a77cdcf34f93
CRs-Fixed: 2005153
parent 96d3138f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@
#define NUM_PIXEL_LOW_RES_PANEL (720*1280)
#endif

#define MAX_POSITION 32767
namespace android {

// ---------------------------------------------------------------------------
@@ -1693,6 +1694,10 @@ uint32_t Layer::setTransactionFlags(uint32_t flags) {
bool Layer::setPosition(float x, float y, bool immediate) {
    if (mCurrentState.requested.transform.tx() == x && mCurrentState.requested.transform.ty() == y)
        return false;
    if ((y > MAX_POSITION) || (x > MAX_POSITION)) {
        ALOGE("%s:: failed %s  x = %f y = %f",__FUNCTION__,mName.string(),x, y);
        return false;
    }
    mCurrentState.sequence++;

    // We update the requested and active position simultaneously because