diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-10-01 23:06:24 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-10-01 23:06:24 +0000 |
commit | 0d311974181d80b92678c9b2335c40ea5076e9ac (patch) | |
tree | 24704f46d9e38119088b9d291e3d2e01538eeb0a | |
parent | 4df4291b330ba08b6810f9571db2792cebf2c90c (diff) | |
parent | 669090928a6a6e87f36d07d63c14ea1b97f38d37 (diff) | |
download | native-0d311974181d80b92678c9b2335c40ea5076e9ac.tar.gz |
Snap for 6877993 from 669090928a6a6e87f36d07d63c14ea1b97f38d37 to rvc-qpr1-releaseandroid-11.0.0_r23android-11.0.0_r18android11-qpr1-s2-release
Change-Id: Ib970f7c29150ecf2b5c2cb0fb878be05a921efd0
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 3b9c7b77c7..e9965d4717 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -2410,7 +2410,15 @@ InputWindowInfo Layer::fillInputInfo() { xSurfaceInset = (xSurfaceInset >= 0) ? std::min(xSurfaceInset, layerBounds.getWidth() / 2) : 0; ySurfaceInset = (ySurfaceInset >= 0) ? std::min(ySurfaceInset, layerBounds.getHeight() / 2) : 0; - layerBounds.inset(xSurfaceInset, ySurfaceInset, xSurfaceInset, ySurfaceInset); + // inset while protecting from overflow TODO(b/161235021): What is going wrong + // in the overflow scenario? + { + int32_t tmp; + if (!__builtin_add_overflow(layerBounds.left, xSurfaceInset, &tmp)) layerBounds.left = tmp; + if (!__builtin_sub_overflow(layerBounds.right, xSurfaceInset, &tmp)) layerBounds.right = tmp; + if (!__builtin_add_overflow(layerBounds.top, ySurfaceInset, &tmp)) layerBounds.top = tmp; + if (!__builtin_sub_overflow(layerBounds.bottom, ySurfaceInset, &tmp)) layerBounds.bottom = tmp; + } // Input coordinate should match the layer bounds. info.frameLeft = layerBounds.left; |