summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdy Abraham <adyabr@google.com>2022-08-05 19:04:16 +0000
committerVishnu Nair <vishnun@google.com>2023-04-11 15:49:12 +0000
commitf4bd36b72dfde8d67cf62d43d56b8ff27e15e2cc (patch)
tree9a4f30fdb3f8a6837cdbb34f784dd4fbdab7ed15
parentb218143d95d241509954a82050c747ee18bdffc8 (diff)
downloadnative-f4bd36b72dfde8d67cf62d43d56b8ff27e15e2cc.tar.gz
SurfaceComposerClient: add a range check in setAlpha
Merged-In: I172321a4d3533e0506bad75a0a91e33fe921c2b7 Change-Id: I172321a4d3533e0506bad75a0a91e33fe921c2b7 Test: presubmit Bug: 274213741
-rw-r--r--libs/gui/SurfaceComposerClient.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 0f5192d41c..70013396d6 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -1274,6 +1274,12 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setAlpha
mStatus = BAD_INDEX;
return *this;
}
+ if (alpha < 0.0f || alpha > 1.0f) {
+ ALOGE("SurfaceComposerClient::Transaction::setAlpha: invalid alpha %f", alpha);
+ mStatus = BAD_VALUE;
+ return *this;
+
+ }
s->what |= layer_state_t::eAlphaChanged;
s->alpha = alpha;