mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 06:40:42 -07:00
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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user