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
d97e6a47
Commit
d97e6a47
authored
Jun 26, 2010
by
Eric Pouech
Committed by
Alexandre Julliard
Jun 28, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: Test validity of COFF symbol table against file size (and not image size).
parent
1f5ff751
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
pe_module.c
dlls/dbghelp/pe_module.c
+10
-7
No files found.
dlls/dbghelp/pe_module.c
View file @
d97e6a47
...
...
@@ -177,17 +177,17 @@ unsigned pe_get_map_size(const struct image_section_map* ism)
* Checks whether the PointerToSymbolTable and NumberOfSymbols in file_header contain
* valid information.
*/
static
BOOL
pe_is_valid_pointer_table
(
const
IMAGE_NT_HEADERS
*
nthdr
,
const
void
*
mapping
)
static
BOOL
pe_is_valid_pointer_table
(
const
IMAGE_NT_HEADERS
*
nthdr
,
const
void
*
mapping
,
DWORD64
sz
)
{
DWORD64
offset
;
/* is the iSym table inside file
image ?
*/
/* is the iSym table inside file
size ? (including first DWORD of string table, which is its size)
*/
offset
=
(
DWORD64
)
nthdr
->
FileHeader
.
PointerToSymbolTable
;
offset
+=
(
DWORD64
)
nthdr
->
FileHeader
.
NumberOfSymbols
*
sizeof
(
IMAGE_SYMBOL
);
if
(
offset
>
(
DWORD64
)
nthdr
->
OptionalHeader
.
SizeOfImage
)
return
FALSE
;
/* is string table (following iSym table) inside file
imag
e ? */
offset
+=
(
DWORD64
)
nthdr
->
FileHeader
.
NumberOfSymbols
*
sizeof
(
IMAGE_SYMBOL
)
+
sizeof
(
DWORD
)
;
if
(
offset
>
sz
)
return
FALSE
;
/* is string table (following iSym table) inside file
siz
e ? */
offset
+=
*
(
DWORD
*
)((
const
char
*
)
mapping
+
offset
);
return
offset
<=
(
DWORD64
)
nthdr
->
OptionalHeader
.
SizeOfImage
;
return
offset
<=
sz
;
}
/******************************************************************
...
...
@@ -228,7 +228,9 @@ static BOOL pe_map_file(HANDLE file, struct image_file_map* fmap, enum module_ty
}
if
(
nthdr
->
FileHeader
.
PointerToSymbolTable
&&
nthdr
->
FileHeader
.
NumberOfSymbols
)
{
if
(
pe_is_valid_pointer_table
(
nthdr
,
mapping
))
LARGE_INTEGER
li
;
if
(
GetFileSizeEx
(
file
,
&
li
)
&&
pe_is_valid_pointer_table
(
nthdr
,
mapping
,
li
.
QuadPart
))
{
/* FIXME ugly: should rather map the relevant content instead of copying it */
const
char
*
src
=
(
const
char
*
)
mapping
+
...
...
@@ -243,6 +245,7 @@ static BOOL pe_map_file(HANDLE file, struct image_file_map* fmap, enum module_ty
}
else
{
WARN
(
"Bad coff table... wipping out
\n
"
);
/* we have bad information here, wipe it out */
fmap
->
u
.
pe
.
ntheader
.
FileHeader
.
PointerToSymbolTable
=
0
;
fmap
->
u
.
pe
.
ntheader
.
FileHeader
.
NumberOfSymbols
=
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