Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
5ef6f8e3
Commit
5ef6f8e3
authored
Jan 01, 2012
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug 1337 - joystick crash due to heap corruption with btnx
parent
6f8f49c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
SDL_joystick.c
src/joystick/SDL_joystick.c
+20
-0
No files found.
src/joystick/SDL_joystick.c
View file @
5ef6f8e3
...
@@ -427,6 +427,11 @@ SDL_PrivateJoystickAxis(SDL_Joystick * joystick, Uint8 axis, Sint16 value)
...
@@ -427,6 +427,11 @@ SDL_PrivateJoystickAxis(SDL_Joystick * joystick, Uint8 axis, Sint16 value)
{
{
int
posted
;
int
posted
;
/* Make sure we're not getting garbage events */
if
(
axis
>=
joystick
->
naxes
)
{
return
0
;
}
/* Update internal joystick state */
/* Update internal joystick state */
joystick
->
axes
[
axis
]
=
value
;
joystick
->
axes
[
axis
]
=
value
;
...
@@ -454,6 +459,11 @@ SDL_PrivateJoystickHat(SDL_Joystick * joystick, Uint8 hat, Uint8 value)
...
@@ -454,6 +459,11 @@ SDL_PrivateJoystickHat(SDL_Joystick * joystick, Uint8 hat, Uint8 value)
{
{
int
posted
;
int
posted
;
/* Make sure we're not getting garbage events */
if
(
hat
>=
joystick
->
nhats
)
{
return
0
;
}
/* Update internal joystick state */
/* Update internal joystick state */
joystick
->
hats
[
hat
]
=
value
;
joystick
->
hats
[
hat
]
=
value
;
...
@@ -482,6 +492,11 @@ SDL_PrivateJoystickBall(SDL_Joystick * joystick, Uint8 ball,
...
@@ -482,6 +492,11 @@ SDL_PrivateJoystickBall(SDL_Joystick * joystick, Uint8 ball,
{
{
int
posted
;
int
posted
;
/* Make sure we're not getting garbage events */
if
(
ball
>=
joystick
->
nballs
)
{
return
0
;
}
/* Update internal mouse state */
/* Update internal mouse state */
joystick
->
balls
[
ball
].
dx
+=
xrel
;
joystick
->
balls
[
ball
].
dx
+=
xrel
;
joystick
->
balls
[
ball
].
dy
+=
yrel
;
joystick
->
balls
[
ball
].
dy
+=
yrel
;
...
@@ -526,6 +541,11 @@ SDL_PrivateJoystickButton(SDL_Joystick * joystick, Uint8 button, Uint8 state)
...
@@ -526,6 +541,11 @@ SDL_PrivateJoystickButton(SDL_Joystick * joystick, Uint8 button, Uint8 state)
}
}
#endif
/* !SDL_EVENTS_DISABLED */
#endif
/* !SDL_EVENTS_DISABLED */
/* Make sure we're not getting garbage events */
if
(
button
>=
joystick
->
nbuttons
)
{
return
0
;
}
/* Update internal joystick state */
/* Update internal joystick state */
joystick
->
buttons
[
button
]
=
state
;
joystick
->
buttons
[
button
]
=
state
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment