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

Commit aa5a51a4 authored by hupeng3's avatar hupeng3 Committed by Hu Peng
Browse files

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: default avatarhupeng3 <hp121520@gmail.com>
Change-Id: Id4a01152bc4103976d3f60e69eb375e3d32669a0
parent e812abdd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);