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

Commit b8fd3ef5 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Delete struct PointerData to fix ODR violation

This data structure is defined with the same name in
PreferStylusOverTouch_test and in UnwantedInteractionBlocker_test. This
creates a "one-definition-rule" violation.
This violation is not getting caught by the compiler today.

As a result, this causes the read to go out of bounds when the wrong
data structure is used. The issue can be reproduced by running the tests
on host.

To fix it, simply remove this struct and fallback to the Point struct
from libui.

Bug: 217165277 249591924 251318977
Test: atest --host --no-bazel-mode inputflinger_tests
Change-Id: I79e0647df63bbf69dd3074f1bd2931b298f4cd48
parent 5a1e9348
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -33,14 +33,8 @@ static constexpr int32_t POINTER_1_DOWN =
constexpr int32_t TOUCHSCREEN = AINPUT_SOURCE_TOUCHSCREEN;
constexpr int32_t STYLUS = AINPUT_SOURCE_STYLUS;

struct PointerData {
    float x;
    float y;
};

static NotifyMotionArgs generateMotionArgs(nsecs_t downTime, nsecs_t eventTime, int32_t action,
                                           const std::vector<PointerData>& points,
                                           uint32_t source) {
                                           const std::vector<Point>& points, uint32_t source) {
    size_t pointerCount = points.size();
    if (action == DOWN || action == UP) {
        EXPECT_EQ(1U, pointerCount) << "Actions DOWN and UP can only contain a single pointer";