api: fix unbounded access in getting analog state (#544)

## Link to GitHub Issue, if one exists
#0

## Description of change
Occasionally we would read a bad "vKey" for an analog axis and end up
accessing invalid memory (beyond the size of a vector) and potentially
crash or read junk values.

## Testing
Fixed based on minidump, this was a rare repro though.
This commit is contained in:
bicarus
2026-01-30 20:53:13 -08:00
committed by GitHub
parent 875a0f0765
commit 927170ce73
2 changed files with 7 additions and 4 deletions
+1
View File
@@ -1743,6 +1743,7 @@ namespace overlay::windows {
auto analog_name = analog.getName();
auto analog_display = analog.getDisplayString(RI_MGR.get());
auto analog_state = GameAPI::Analogs::getState(RI_MGR, analog);
analog_state = std::clamp(analog_state, 0.f, 1.f);
// list entry
ImGui::ProgressBar(analog_state, ImVec2(32.f, 0));