Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix out-of-bounds access in XWindowsScreen::updateButtons #1827

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/lib/platform/XWindowsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1941,15 +1941,15 @@ XWindowsScreen::updateButtons()
}

// allocate button array
m_buttons.resize(maxButton);
m_buttons.resize(maxButton + 1);

// fill in button array values. m_buttons[i] is the physical
// button number for logical button i+1.
for (UInt32 i = 0; i < numButtons; ++i) {
// button number for logical button i.
for (UInt32 i = 0; i < maxButton + 1; ++i) {
m_buttons[i] = 0;
}
for (UInt32 i = 0; i < numButtons; ++i) {
m_buttons[tmpButtons[i] - 1] = i + 1;
m_buttons[tmpButtons[i]] = i;
}

// clean up
Expand Down
2 changes: 1 addition & 1 deletion src/lib/platform/XWindowsScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class XWindowsScreen : public PlatformScreen {
bool m_screensaverNotify;

// logical to physical button mapping. m_buttons[i] gives the
// physical button for logical button i+1.
// physical button for logical button i.
std::vector<unsigned char> m_buttons;

// true if global auto-repeat was enabled before we turned it off
Expand Down