diff options
| author | 2023-07-20 20:46:09 +0000 | |
|---|---|---|
| committer | 2023-07-20 20:46:09 +0000 | |
| commit | f44ab48b78109f876671532ca390bfa34a12e78d (patch) | |
| tree | b375443ea33521c98feb6ec85e16d0a0e3d8ec76 | |
| parent | 955b6137114012c7b70c88f07de08410c539a7fa (diff) | |
EventHub: Ensure bit arrays are large enough to store all event codes
We were previously initializing bit arrays with a min size equaling to
the MAX value for the event type (i.e. initialize array of min size
KEY_MAX for EV_KEY). This is incorrect, because the max value could be a
possible valid value, in which case it could not be stored in the array.
The bit arrays should be initialzed with the min size equaling the count
of the values (CNT == MAX + 1; e.g. KEY_CNT).
Bug: 290938220
Test: None
Change-Id: I1fa748f521a8539da444a4ae6e31cc4fb49be138
| -rw-r--r-- | services/inputflinger/reader/include/EventHub.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/services/inputflinger/reader/include/EventHub.h b/services/inputflinger/reader/include/EventHub.h index 8347df8bdc..0bcab42417 100644 --- a/services/inputflinger/reader/include/EventHub.h +++ b/services/inputflinger/reader/include/EventHub.h @@ -626,16 +626,16 @@ private: ftl::Flags<InputDeviceClass> classes; - BitArray<KEY_MAX> keyBitmask; - BitArray<KEY_MAX> keyState; - BitArray<REL_MAX> relBitmask; - BitArray<SW_MAX> swBitmask; - BitArray<SW_MAX> swState; - BitArray<LED_MAX> ledBitmask; - BitArray<FF_MAX> ffBitmask; - BitArray<INPUT_PROP_MAX> propBitmask; - BitArray<MSC_MAX> mscBitmask; - BitArray<ABS_MAX> absBitmask; + BitArray<KEY_CNT> keyBitmask; + BitArray<KEY_CNT> keyState; + BitArray<REL_CNT> relBitmask; + BitArray<SW_CNT> swBitmask; + BitArray<SW_CNT> swState; + BitArray<LED_CNT> ledBitmask; + BitArray<FF_CNT> ffBitmask; + BitArray<INPUT_PROP_CNT> propBitmask; + BitArray<MSC_CNT> mscBitmask; + BitArray<ABS_CNT> absBitmask; struct AxisState { RawAbsoluteAxisInfo info; int value; |