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
e36c0d83
Commit
e36c0d83
authored
Sep 05, 2011
by
Andreas Schiffler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added input parameter validation to some SDL_rect functions
parent
6584aa6a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
SDL_rect.c
src/video/SDL_rect.c
+36
-0
No files found.
src/video/SDL_rect.c
View file @
e36c0d83
...
...
@@ -28,6 +28,11 @@ SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B)
{
int
Amin
,
Amax
,
Bmin
,
Bmax
;
if
(
!
A
||
!
B
)
{
// TODO error message
return
SDL_FALSE
;
}
/* Horizontal intersection */
Amin
=
A
->
x
;
Amax
=
Amin
+
A
->
w
;
...
...
@@ -60,6 +65,11 @@ SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
{
int
Amin
,
Amax
,
Bmin
,
Bmax
;
if
(
!
A
||
!
B
||
!
result
)
{
// TODO error message
return
SDL_FALSE
;
}
/* Horizontal intersection */
Amin
=
A
->
x
;
Amax
=
Amin
+
A
->
w
;
...
...
@@ -92,6 +102,10 @@ SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
{
int
Amin
,
Amax
,
Bmin
,
Bmax
;
if
(
!
A
||
!
B
||
!
result
)
{
return
;
}
/* Horizontal union */
Amin
=
A
->
x
;
Amax
=
Amin
+
A
->
w
;
...
...
@@ -127,7 +141,13 @@ SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip,
int
maxy
=
0
;
int
x
,
y
,
i
;
if
(
!
points
||
!
clip
)
{
// TODO error message
return
SDL_FALSE
;
}
if
(
count
<
1
)
{
// TODO error message
return
SDL_FALSE
;
}
...
...
@@ -234,6 +254,7 @@ SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2,
int
outcode1
,
outcode2
;
if
(
!
rect
||
!
X1
||
!
Y1
||
!
X2
||
!
Y2
)
{
// TODO error message
return
SDL_FALSE
;
}
...
...
@@ -347,6 +368,21 @@ SDL_GetSpanEnclosingRect(int width, int height,
int
span_y1
,
span_y2
;
int
rect_y1
,
rect_y2
;
if
(
width
<
1
||
height
<
1
)
{
// TODO error message
return
SDL_FALSE
;
}
if
(
!
rects
||
!
span
)
{
// TODO error message
return
SDL_FALSE
;
}
if
(
numrects
<
1
)
{
// TODO error message
return
SDL_FALSE
;
}
/* Initialize to empty rect */
span_y1
=
height
;
span_y2
=
0
;
...
...
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