Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
f3eb64ec
Commit
f3eb64ec
authored
Jun 04, 2013
by
Piotr Caban
Committed by
Alexandre Julliard
Jun 04, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Don't detect overflow in atoi implementation.
parent
0210cb93
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
71 additions
and
7 deletions
+71
-7
msvcr100.c
dlls/msvcr100/msvcr100.c
+5
-0
msvcr100.spec
dlls/msvcr100/msvcr100.spec
+1
-1
msvcr100.c
dlls/msvcr100/tests/msvcr100.c
+20
-0
msvcr110.spec
dlls/msvcr110/msvcr110.spec
+1
-1
msvcr70.spec
dlls/msvcr70/msvcr70.spec
+1
-1
msvcr71.spec
dlls/msvcr71/msvcr71.spec
+1
-1
msvcr80.spec
dlls/msvcr80/msvcr80.spec
+1
-1
msvcr90.spec
dlls/msvcr90/msvcr90.spec
+1
-1
string.c
dlls/msvcrt/string.c
+21
-1
string.c
dlls/msvcrt/tests/string.c
+18
-0
stdlib.h
include/msvcrt/stdlib.h
+1
-0
No files found.
dlls/msvcr100/msvcr100.c
View file @
f3eb64ec
...
...
@@ -484,6 +484,11 @@ size_t CDECL _aligned_msize(void *p, size_t alignment, size_t offset)
return
_msize
(
*
alloc_ptr
)
-
alignment
-
sizeof
(
void
*
);
}
int
CDECL
MSVCR100_atoi
(
const
char
*
str
)
{
return
_atoi_l
(
str
,
NULL
);
}
/*********************************************************************
* DllMain (MSVCR100.@)
*/
...
...
dlls/msvcr100/msvcr100.spec
View file @
f3eb64ec
...
...
@@ -1629,7 +1629,7 @@
@ cdecl -arch=arm,x86_64 atan2f(float float) msvcrt.atan2f
@ cdecl atexit(ptr) msvcrt.atexit
@ cdecl atof(str) msvcrt.atof
@ cdecl atoi(str)
msvcrt.
atoi
@ cdecl atoi(str)
MSVCR100_
atoi
@ cdecl atol(str) msvcrt.atol
@ cdecl bsearch(ptr ptr long long ptr) msvcrt.bsearch
@ cdecl bsearch_s(ptr ptr long long ptr ptr) msvcrt.bsearch_s
...
...
dlls/msvcr100/tests/msvcr100.c
View file @
f3eb64ec
...
...
@@ -75,6 +75,7 @@ static size_t (__cdecl *p_fread_s)(void*,size_t,size_t,size_t,FILE*);
static
void
*
(
__cdecl
*
p__aligned_offset_malloc
)(
size_t
,
size_t
,
size_t
);
static
void
(
__cdecl
*
p__aligned_free
)(
void
*
);
static
size_t
(
__cdecl
*
p__aligned_msize
)(
void
*
,
size_t
,
size_t
);
static
int
(
__cdecl
*
p_atoi
)(
const
char
*
);
/* make sure we use the correct errno */
#undef errno
...
...
@@ -104,6 +105,7 @@ static BOOL init(void)
SET
(
p__aligned_offset_malloc
,
"_aligned_offset_malloc"
);
SET
(
p__aligned_free
,
"_aligned_free"
);
SET
(
p__aligned_msize
,
"_aligned_msize"
);
SET
(
p_atoi
,
"atoi"
);
return
TRUE
;
}
...
...
@@ -358,6 +360,23 @@ static void test__aligned_msize(void)
p__aligned_free
(
mem
);
}
static
void
test_atoi
(
void
)
{
int
r
;
r
=
p_atoi
(
"0"
);
ok
(
r
==
0
,
"atoi(0) = %d
\n
"
,
r
);
r
=
p_atoi
(
"-1"
);
ok
(
r
==
-
1
,
"atoi(-1) = %d
\n
"
,
r
);
r
=
p_atoi
(
"1"
);
ok
(
r
==
1
,
"atoi(1) = %d
\n
"
,
r
);
r
=
p_atoi
(
"4294967296"
);
ok
(
r
==
2147483647
,
"atoi(4294967296) = %d
\n
"
,
r
);
}
START_TEST
(
msvcr100
)
{
if
(
!
init
())
...
...
@@ -367,4 +386,5 @@ START_TEST(msvcr100)
test_wmemmove_s
();
test_fread_s
();
test__aligned_msize
();
test_atoi
();
}
dlls/msvcr110/msvcr110.spec
View file @
f3eb64ec
...
...
@@ -1991,7 +1991,7 @@
@ cdecl -arch=arm,x86_64 atan2f(float float) msvcrt.atan2f
@ cdecl atexit(ptr) msvcrt.atexit
@ cdecl atof(str) msvcrt.atof
@ cdecl atoi(str) msvcr
t.atoi
@ cdecl atoi(str) msvcr
100.atoi #don't forward to msvcrt
@ cdecl atol(str) msvcrt.atol
@ cdecl bsearch(ptr ptr long long ptr) msvcrt.bsearch
@ cdecl bsearch_s(ptr ptr long long ptr ptr) msvcrt.bsearch_s
...
...
dlls/msvcr70/msvcr70.spec
View file @
f3eb64ec
...
...
@@ -688,7 +688,7 @@
@ cdecl atan2(double double) msvcrt.atan2
@ cdecl atexit(ptr) msvcrt.atexit
@ cdecl atof(str) msvcrt.atof
@ cdecl atoi(str) msvcr
t.atoi
@ cdecl atoi(str) msvcr
100.atoi #don't forward to msvcrt
@ cdecl atol(str) msvcrt.atol
@ cdecl bsearch(ptr ptr long long ptr) msvcrt.bsearch
@ cdecl calloc(long long) msvcrt.calloc
...
...
dlls/msvcr71/msvcr71.spec
View file @
f3eb64ec
...
...
@@ -684,7 +684,7 @@
@ cdecl atan2(double double) msvcrt.atan2
@ cdecl atexit(ptr) msvcrt.atexit
@ cdecl atof(str) msvcrt.atof
@ cdecl atoi(str) msvcr
t.atoi
@ cdecl atoi(str) msvcr
100.atoi #don't forward to msvcrt
@ cdecl atol(str) msvcrt.atol
@ cdecl bsearch(ptr ptr long long ptr) msvcrt.bsearch
@ cdecl calloc(long long) msvcrt.calloc
...
...
dlls/msvcr80/msvcr80.spec
View file @
f3eb64ec
...
...
@@ -1310,7 +1310,7 @@
@ cdecl -arch=arm,x86_64 atan2f(float float) msvcrt.atan2f
@ cdecl atexit(ptr) msvcrt.atexit
@ cdecl atof(str) msvcrt.atof
@ cdecl atoi(str) msvcr
t.atoi
@ cdecl atoi(str) msvcr
100.atoi #don't forward to msvcrt
@ cdecl atol(str) msvcrt.atol
@ cdecl bsearch(ptr ptr long long ptr) msvcrt.bsearch
@ cdecl bsearch_s(ptr ptr long long ptr ptr) msvcrt.bsearch_s
...
...
dlls/msvcr90/msvcr90.spec
View file @
f3eb64ec
...
...
@@ -1283,7 +1283,7 @@
@ cdecl -arch=arm,x86_64 atanf(float) msvcrt.atanf
@ cdecl atexit(ptr) msvcrt.atexit
@ cdecl atof(str) msvcrt.atof
@ cdecl atoi(str) msvcr
t.atoi
@ cdecl atoi(str) msvcr
100.atoi ##don't forward to msvcrt
@ cdecl atol(str) msvcrt.atol
@ cdecl bsearch(ptr ptr long long ptr) msvcrt.bsearch
@ cdecl bsearch_s(ptr ptr long long ptr ptr) msvcrt.bsearch_s
...
...
dlls/msvcrt/string.c
View file @
f3eb64ec
...
...
@@ -893,7 +893,27 @@ int __cdecl MSVCRT__atoi_l(const char *str, MSVCRT__locale_t locale)
*/
int
__cdecl
MSVCRT_atoi
(
const
char
*
str
)
{
return
MSVCRT__atoi_l
(
str
,
NULL
);
BOOL
minus
=
FALSE
;
int
ret
=
0
;
if
(
!
str
)
return
0
;
while
(
isspace
(
*
str
))
str
++
;
if
(
*
str
==
'+'
)
{
str
++
;
}
else
if
(
*
str
==
'-'
)
{
minus
=
TRUE
;
str
++
;
}
while
(
*
str
>=
'0'
&&
*
str
<=
'9'
)
{
ret
=
ret
*
10
+*
str
-
'0'
;
str
++
;
}
return
minus
?
-
ret
:
ret
;
}
/*********************************************************************
...
...
dlls/msvcrt/tests/string.c
View file @
f3eb64ec
...
...
@@ -2521,6 +2521,23 @@ static void test__wcstoi64(void)
return
;
}
static
void
test_atoi
(
void
)
{
int
r
;
r
=
atoi
(
"0"
);
ok
(
r
==
0
,
"atoi(0) = %d
\n
"
,
r
);
r
=
atoi
(
"-1"
);
ok
(
r
==
-
1
,
"atoi(-1) = %d
\n
"
,
r
);
r
=
atoi
(
"1"
);
ok
(
r
==
1
,
"atoi(1) = %d
\n
"
,
r
);
r
=
atoi
(
"4294967296"
);
ok
(
r
==
0
,
"atoi(4294967296) = %d
\n
"
,
r
);
}
START_TEST
(
string
)
{
char
mem
[
100
];
...
...
@@ -2620,4 +2637,5 @@ START_TEST(string)
test__atodbl
();
test__stricmp
();
test__wcstoi64
();
test_atoi
();
}
include/msvcrt/stdlib.h
View file @
f3eb64ec
...
...
@@ -182,6 +182,7 @@ int __cdecl abs(int);
int
__cdecl
atexit
(
void
(
*
)(
void
));
double
__cdecl
atof
(
const
char
*
);
int
__cdecl
atoi
(
const
char
*
);
int
__cdecl
_atoi_l
(
const
char
*
,
_locale_t
);
__msvcrt_long
__cdecl
atol
(
const
char
*
);
void
*
__cdecl
calloc
(
size_t
,
size_t
);
#ifndef __i386__
...
...
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