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
bf95bccf
Commit
bf95bccf
authored
Feb 06, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quartz: Fix hex digit checks in process_pattern_string.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6e8c2d83
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
32 deletions
+14
-32
filesource.c
dlls/quartz/filesource.c
+14
-32
No files found.
dlls/quartz/filesource.c
View file @
bf95bccf
...
...
@@ -87,37 +87,19 @@ static inline AsyncReader *impl_from_IFileSourceFilter(IFileSourceFilter *iface)
static
const
IFileSourceFilterVtbl
FileSource_Vtbl
;
static
const
IAsyncReaderVtbl
FileAsyncReader_Vtbl
;
static
unsigned
char
byte_from_hex_char
(
WCHAR
wHex
)
static
int
byte_from_hex_char
(
WCHAR
c
)
{
switch
(
towlower
(
wHex
))
{
case
'0'
:
case
'1'
:
case
'2'
:
case
'3'
:
case
'4'
:
case
'5'
:
case
'6'
:
case
'7'
:
case
'8'
:
case
'9'
:
return
(
wHex
-
'0'
)
&
0xf
;
case
'a'
:
case
'b'
:
case
'c'
:
case
'd'
:
case
'e'
:
case
'f'
:
return
(
wHex
-
'a'
+
10
)
&
0xf
;
default:
return
0
;
}
if
(
'0'
<=
c
&&
c
<=
'9'
)
return
c
-
'0'
;
if
(
'a'
<=
c
&&
c
<=
'f'
)
return
c
-
'a'
+
10
;
if
(
'A'
<=
c
&&
c
<=
'F'
)
return
c
-
'A'
+
10
;
return
-
1
;
}
static
BOOL
process_pattern_string
(
const
WCHAR
*
pattern
,
HANDLE
file
)
{
ULONG
size
,
offset
,
i
,
ret_size
;
BYTE
*
mask
,
*
expect
,
*
actual
;
int
d
;
BOOL
ret
=
TRUE
;
/* format: "offset, size, mask, value" */
...
...
@@ -140,15 +122,15 @@ static BOOL process_pattern_string(const WCHAR *pattern, HANDLE file)
return
FALSE
;
}
pattern
++
;
while
(
!
iswxdigit
(
*
pattern
)
&&
(
*
pattern
!=
','
))
while
(
byte_from_hex_char
(
*
pattern
)
==
-
1
&&
(
*
pattern
!=
','
))
pattern
++
;
for
(
i
=
0
;
iswxdigit
(
*
pattern
)
&&
(
i
/
2
<
size
);
pattern
++
,
i
++
)
for
(
i
=
0
;
(
d
=
byte_from_hex_char
(
*
pattern
))
!=
-
1
&&
(
i
/
2
<
size
);
pattern
++
,
i
++
)
{
if
(
i
%
2
)
mask
[
i
/
2
]
|=
byte_from_hex_char
(
*
pattern
)
;
mask
[
i
/
2
]
|=
d
;
else
mask
[
i
/
2
]
=
byte_from_hex_char
(
*
pattern
)
<<
4
;
mask
[
i
/
2
]
=
d
<<
4
;
}
if
(
!
(
pattern
=
wcschr
(
pattern
,
','
)))
...
...
@@ -158,15 +140,15 @@ static BOOL process_pattern_string(const WCHAR *pattern, HANDLE file)
return
FALSE
;
}
pattern
++
;
while
(
!
iswxdigit
(
*
pattern
)
&&
(
*
pattern
!=
','
))
while
(
byte_from_hex_char
(
*
pattern
)
==
-
1
&&
(
*
pattern
!=
','
))
pattern
++
;
for
(
i
=
0
;
iswxdigit
(
*
pattern
)
&&
(
i
/
2
<
size
);
pattern
++
,
i
++
)
for
(
i
=
0
;
(
d
=
byte_from_hex_char
(
*
pattern
))
!=
-
1
&&
(
i
/
2
<
size
);
pattern
++
,
i
++
)
{
if
(
i
%
2
)
expect
[
i
/
2
]
|=
byte_from_hex_char
(
*
pattern
)
;
expect
[
i
/
2
]
|=
d
;
else
expect
[
i
/
2
]
=
byte_from_hex_char
(
*
pattern
)
<<
4
;
expect
[
i
/
2
]
=
d
<<
4
;
}
actual
=
heap_alloc
(
size
);
...
...
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