diff options
author | 2019-02-28 08:16:26 -0800 | |
---|---|---|
committer | 2019-03-01 17:05:47 -0800 | |
commit | fd3718c0dd22c3a8a2317cb659b0eed2305e579c (patch) | |
tree | 34e45d5c583a32d10201bcc2cf7d849b7f4c3279 /libs/gui/BufferQueueThreadState.cpp | |
parent | c086504b8c5057d935dd07e41b7c13d6f94285aa (diff) |
Initialize PointerCoords in input tests
The struct PointerCoords in VelocityTracker_test is created on the
stack, but never initialized. Later, the coords are used to add an x and
y value to the MotionEvent.
The field "bits" in the struct is therefore initialized to whatever was
previously occupying that stack address.
It is possible that stack contained some non-zero data. This would cause
enough of the bits of the 'bits' variable to be set, but without any of
them being X or Y. As a result, when a new X or Y value is assigned, it
does not fit into the bits (there's a 30-axes limit), and therefore
remains at zero.
Later, when velocity is computed, the coordinates evaluate to zero, and
therefore, zero velocity is produced. The test fails, because a non-zero
velocity is expected.
After an audit of the entire Android codebase for usage of
PointerCoords, found another potential issue in InputClassifier_test.
Likely the code was copied over from VelocityTracker_test. Add a fix for
that as well.
Bug: 126536349
Test: atest -it -a libinput_tests, but only executed after building and
flashing asanified libinput and libinput_tests onto device.
Change-Id: Id8b870b6201d7489284bf9fc646750770bb9321a
Diffstat (limited to 'libs/gui/BufferQueueThreadState.cpp')
0 files changed, 0 insertions, 0 deletions