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
7cd2821d
Commit
7cd2821d
authored
Dec 12, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Don't validate calendar id for GetCalendarInfo(CAL_ITWODIGITYEARMAX).
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53845
parent
f2d98ea7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
time.c
dlls/kernel32/tests/time.c
+17
-1
locale.c
dlls/kernelbase/locale.c
+3
-3
No files found.
dlls/kernel32/tests/time.c
View file @
7cd2821d
...
@@ -681,7 +681,7 @@ static void test_GetCalendarInfo(void)
...
@@ -681,7 +681,7 @@ static void test_GetCalendarInfo(void)
char
bufferA
[
20
];
char
bufferA
[
20
];
WCHAR
bufferW
[
20
];
WCHAR
bufferW
[
20
];
DWORD
val1
,
val2
;
DWORD
val1
,
val2
;
int
ret
,
ret2
;
int
i
,
j
,
ret
,
ret2
;
if
(
!
pGetCalendarInfoA
||
!
pGetCalendarInfoW
)
if
(
!
pGetCalendarInfoA
||
!
pGetCalendarInfoW
)
{
{
...
@@ -744,6 +744,22 @@ static void test_GetCalendarInfo(void)
...
@@ -744,6 +744,22 @@ static void test_GetCalendarInfo(void)
ok
(
ret2
,
"GetCalendarInfoW failed err %lu
\n
"
,
GetLastError
()
);
ok
(
ret2
,
"GetCalendarInfoW failed err %lu
\n
"
,
GetLastError
()
);
ret2
=
WideCharToMultiByte
(
CP_ACP
,
0
,
bufferW
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
ret2
=
WideCharToMultiByte
(
CP_ACP
,
0
,
bufferW
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
ok
(
ret
==
ret2
,
"got %d, expected %d
\n
"
,
ret
,
ret2
);
ok
(
ret
==
ret2
,
"got %d, expected %d
\n
"
,
ret
,
ret2
);
for
(
i
=
CAL_GREGORIAN
;
i
<=
CAL_UMALQURA
;
i
++
)
{
WCHAR
name
[
80
];
ret
=
pGetCalendarInfoW
(
0x0409
,
i
,
CAL_SCALNAME
,
name
,
ARRAY_SIZE
(
name
),
NULL
);
for
(
j
=
CAL_ICALINTVALUE
;
j
<=
CAL_SRELATIVELONGDATE
;
j
++
)
{
ret2
=
pGetCalendarInfoW
(
0x0409
,
i
,
j
,
bufferW
,
ARRAY_SIZE
(
bufferW
),
NULL
);
if
(
ret
||
j
==
CAL_ITWODIGITYEARMAX
)
ok
(
ret2
||
broken
(
j
==
CAL_SRELATIVELONGDATE
),
/* win7 doesn't have this */
"calendar %u %s value %02x failed
\n
"
,
i
,
wine_dbgstr_w
(
name
),
j
);
else
ok
(
!
ret2
,
"calendar %u %s value %02x succeeded %s
\n
"
,
i
,
wine_dbgstr_w
(
name
),
j
,
wine_dbgstr_w
(
bufferW
)
);
}
}
}
}
static
void
test_GetDynamicTimeZoneInformation
(
void
)
static
void
test_GetDynamicTimeZoneInformation
(
void
)
...
...
dlls/kernelbase/locale.c
View file @
7cd2821d
...
@@ -552,8 +552,8 @@ static const NLS_LOCALE_DATA *get_locale_data( UINT idx )
...
@@ -552,8 +552,8 @@ static const NLS_LOCALE_DATA *get_locale_data( UINT idx )
static
const
struct
calendar
*
get_calendar_data
(
const
NLS_LOCALE_DATA
*
locale
,
UINT
id
)
static
const
struct
calendar
*
get_calendar_data
(
const
NLS_LOCALE_DATA
*
locale
,
UINT
id
)
{
{
if
(
id
==
CAL_HIJRI
)
id
=
locale
->
islamic_cal
[
0
];
if
(
id
==
CAL_HIJRI
&&
locale
->
islamic_cal
[
0
]
)
id
=
locale
->
islamic_cal
[
0
];
else
if
(
id
==
CAL_PERSIAN
)
id
=
locale
->
islamic_cal
[
1
];
else
if
(
id
==
CAL_PERSIAN
&&
locale
->
islamic_cal
[
1
]
)
id
=
locale
->
islamic_cal
[
1
];
if
(
!
id
||
id
>
locale_table
->
nb_calendars
)
return
NULL
;
if
(
!
id
||
id
>
locale_table
->
nb_calendars
)
return
NULL
;
return
(
const
struct
calendar
*
)((
const
char
*
)
locale_table
+
locale_table
->
calendars_offset
+
return
(
const
struct
calendar
*
)((
const
char
*
)
locale_table
+
locale_table
->
calendars_offset
+
...
@@ -1617,7 +1617,7 @@ static int get_calendar_info( const NLS_LOCALE_DATA *locale, CALID id, CALTYPE t
...
@@ -1617,7 +1617,7 @@ static int get_calendar_info( const NLS_LOCALE_DATA *locale, CALID id, CALTYPE t
}
}
else
if
(
len
<
0
||
value
)
goto
invalid
;
else
if
(
len
<
0
||
value
)
goto
invalid
;
if
(
id
!=
CAL_GREGORIAN
)
if
(
id
!=
CAL_GREGORIAN
&&
type
!=
CAL_ITWODIGITYEARMAX
)
{
{
const
USHORT
*
ids
=
locale_strings
+
locale
->
scalendartype
;
const
USHORT
*
ids
=
locale_strings
+
locale
->
scalendartype
;
for
(
i
=
0
;
i
<
ids
[
0
];
i
++
)
if
(
ids
[
1
+
i
]
==
id
)
break
;
for
(
i
=
0
;
i
<
ids
[
0
];
i
++
)
if
(
ids
[
1
+
i
]
==
id
)
break
;
...
...
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