summaryrefslogtreecommitdiff
path: root/libs/input/Input.cpp
diff options
context:
space:
mode:
author hupeng3 <hp121520@gmail.com> 2022-09-02 16:00:18 +0800
committer Hu Peng <hp121520@gmail.com> 2022-09-13 01:18:57 +0000
commitaa5a51a47e474749c33ad81132ba54e19357e92a (patch)
treed831bed2200699abbb719d420d6d4771a4da05e6 /libs/input/Input.cpp
parente812abddc0472c3a3d06ec4b705c44a9cf8c85c1 (diff)
Toast: Fix MotionEvent has too many PointerCoords
If the MotionEvent has too many PointerCoords, it will lead to an infinite loop and cannot complete the operator<<. Bug:244248855 Test: printed MotionEvent in log to see the formatting Signed-off-by: hupeng3 <hp121520@gmail.com> Change-Id: Id4a01152bc4103976d3f60e69eb375e3d32669a0
Diffstat (limited to 'libs/input/Input.cpp')
-rw-r--r--libs/input/Input.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp
index 13ca9ecd35..4127f7ce10 100644
--- a/libs/input/Input.cpp
+++ b/libs/input/Input.cpp
@@ -929,6 +929,8 @@ std::ostream& operator<<(std::ostream& out, const MotionEvent& event) {
out << ", actionButton=" << std::to_string(event.getActionButton());
}
const size_t pointerCount = event.getPointerCount();
+ LOG_ALWAYS_FATAL_IF(pointerCount > MAX_POINTERS, "Too many pointers : pointerCount = %zu",
+ pointerCount);
for (size_t i = 0; i < pointerCount; i++) {
out << ", id[" << i << "]=" << event.getPointerId(i);
float x = event.getX(i);