Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
8436b58e
Commit
8436b58e
authored
Jun 17, 2014
by
Piotr Caban
Committed by
Alexandre Julliard
Jun 17, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Use size_t to store indexes in qsort.
It also avoids potential overflow while computing median position (found by Frédéric Delanoy).
parent
40067dd0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
misc.c
dlls/msvcrt/misc.c
+4
-3
No files found.
dlls/msvcrt/misc.c
View file @
8436b58e
...
...
@@ -262,8 +262,9 @@ static void small_sort(void *base, MSVCRT_size_t nmemb, MSVCRT_size_t size,
static
void
quick_sort
(
void
*
base
,
MSVCRT_size_t
nmemb
,
MSVCRT_size_t
size
,
int
(
CDECL
*
compar
)(
void
*
,
const
void
*
,
const
void
*
),
void
*
context
)
{
int
stack_lo
[
8
*
sizeof
(
MSVCRT_size_t
)],
stack_hi
[
8
*
sizeof
(
MSVCRT_size_t
)],
stack_pos
;
int
beg
,
end
,
lo
,
hi
,
med
;
MSVCRT_size_t
stack_lo
[
8
*
sizeof
(
MSVCRT_size_t
)],
stack_hi
[
8
*
sizeof
(
MSVCRT_size_t
)];
MSVCRT_size_t
beg
,
end
,
lo
,
hi
,
med
;
int
stack_pos
;
stack_pos
=
0
;
stack_lo
[
stack_pos
]
=
0
;
...
...
@@ -281,7 +282,7 @@ static void quick_sort(void *base, MSVCRT_size_t nmemb, MSVCRT_size_t size,
lo
=
beg
;
hi
=
end
;
med
=
(
hi
+
lo
+
1
)
/
2
;
med
=
lo
+
(
hi
-
lo
+
1
)
/
2
;
if
(
compar
(
context
,
X
(
lo
),
X
(
med
))
>
0
)
swap
(
X
(
lo
),
X
(
med
),
size
);
if
(
compar
(
context
,
X
(
lo
),
X
(
hi
))
>
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