Skip to content

fix(hidpp20): HiresScroll::getRatchetState reads response, not params#546

Open
jelmerdehen wants to merge 1 commit into
PixlOne:mainfrom
jelmerdehen:fix/hires-scroll-ratchet-state
Open

fix(hidpp20): HiresScroll::getRatchetState reads response, not params#546
jelmerdehen wants to merge 1 commit into
PixlOne:mainfrom
jelmerdehen:fix/hires-scroll-ratchet-state

Conversation

@jelmerdehen
Copy link
Copy Markdown

Summary

HiresScroll::getRatchetState returned params[0] from a freshly-constructed empty std::vector. This produced an out-of-bounds read on every call and always returned a meaningless value regardless of what the device reported.

std::vector<uint8_t> params(0);
auto response = callFunction(GetRatchetState, params);
return params[0];   // <-- empty vector; should be response[0]

Fix

Read response[0] and guard against an empty response.

Test plan

  • Builds cleanly.
  • Function is [[maybe_unused]] and not called anywhere in tree, so no behavioural test exists; verified by inspection.

getRatchetState was returning params[0] from a freshly-constructed
empty vector. This produced an out-of-bounds read on every call and
always returned a meaningless value regardless of what the device
reported. Read response[0] instead, with an empty-response guard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant