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
674ef559
Commit
674ef559
authored
Jul 20, 2022
by
Eric Pouech
Committed by
Alexandre Julliard
Jul 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedbg: Do proper error management when reallocating memory.
Signed-off-by:
Eric Pouech
<
eric.pouech@gmail.com
>
parent
c40bccb8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
23 deletions
+51
-23
break.c
programs/winedbg/break.c
+20
-14
dbg.y
programs/winedbg/dbg.y
+7
-1
display.c
programs/winedbg/display.c
+5
-2
info.c
programs/winedbg/info.c
+15
-4
stack.c
programs/winedbg/stack.c
+4
-2
No files found.
programs/winedbg/break.c
View file @
674ef559
...
...
@@ -202,6 +202,7 @@ BOOL break_add_break(const ADDRESS64* addr, BOOL verbose, BOOL swbp)
*/
BOOL
break_add_break_from_lvalue
(
const
struct
dbg_lvalue
*
lvalue
,
BOOL
swbp
)
{
struct
dbg_delayed_bp
*
new
;
ADDRESS64
addr
;
types_extract_as_address
(
lvalue
,
&
addr
);
...
...
@@ -215,13 +216,15 @@ BOOL break_add_break_from_lvalue(const struct dbg_lvalue* lvalue, BOOL swbp)
return
FALSE
;
}
dbg_printf
(
"Unable to add breakpoint, will check again any time a new DLL is loaded
\n
"
);
dbg_curr_process
->
delayed_bp
=
dbg_heap_realloc
(
dbg_curr_process
->
delayed_bp
,
sizeof
(
struct
dbg_delayed_bp
)
*
++
dbg_curr_process
->
num_delayed_bp
);
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
-
1
].
is_symbol
=
FALSE
;
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
-
1
].
software_bp
=
swbp
;
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
-
1
].
u
.
addr
=
addr
;
new
=
dbg_heap_realloc
(
dbg_curr_process
->
delayed_bp
,
sizeof
(
struct
dbg_delayed_bp
)
*
(
dbg_curr_process
->
num_delayed_bp
+
1
));
if
(
!
new
)
return
FALSE
;
dbg_curr_process
->
delayed_bp
=
new
;
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
].
is_symbol
=
FALSE
;
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
].
software_bp
=
swbp
;
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
].
u
.
addr
=
addr
;
dbg_curr_process
->
num_delayed_bp
++
;
return
TRUE
;
}
return
FALSE
;
...
...
@@ -234,6 +237,7 @@ BOOL break_add_break_from_lvalue(const struct dbg_lvalue* lvalue, BOOL swbp)
*/
void
break_add_break_from_id
(
const
char
*
name
,
int
lineno
,
BOOL
swbp
)
{
struct
dbg_delayed_bp
*
new
;
struct
dbg_lvalue
lvalue
;
int
i
;
...
...
@@ -256,13 +260,15 @@ void break_add_break_from_id(const char *name, int lineno, BOOL swbp)
lineno
==
dbg_curr_process
->
delayed_bp
[
i
].
u
.
symbol
.
lineno
)
return
;
}
dbg_curr_process
->
delayed_bp
=
dbg_heap_realloc
(
dbg_curr_process
->
delayed_bp
,
sizeof
(
struct
dbg_delayed_bp
)
*
++
dbg_curr_process
->
num_delayed_bp
);
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
-
1
].
is_symbol
=
TRUE
;
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
-
1
].
software_bp
=
swbp
;
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
-
1
].
u
.
symbol
.
name
=
strcpy
(
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
name
)
+
1
),
name
);
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
-
1
].
u
.
symbol
.
lineno
=
lineno
;
new
=
dbg_heap_realloc
(
dbg_curr_process
->
delayed_bp
,
sizeof
(
struct
dbg_delayed_bp
)
*
(
dbg_curr_process
->
num_delayed_bp
+
1
));
if
(
!
new
)
return
;
dbg_curr_process
->
delayed_bp
=
new
;
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
].
is_symbol
=
TRUE
;
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
].
software_bp
=
swbp
;
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
].
u
.
symbol
.
name
=
strcpy
(
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
name
)
+
1
),
name
);
dbg_curr_process
->
delayed_bp
[
dbg_curr_process
->
num_delayed_bp
].
u
.
symbol
.
lineno
=
lineno
;
dbg_curr_process
->
num_delayed_bp
++
;
}
struct
cb_break_lineno
...
...
programs/winedbg/dbg.y
View file @
674ef559
...
...
@@ -514,8 +514,14 @@ static int input_fetch_entire_line(const char* pfx, char** line)
if (len + 2 > alloc)
{
char* new;
while (len + 2 > alloc) alloc *= 2;
buffer = dbg_heap_realloc(buffer, alloc);
if (!(new = dbg_heap_realloc(buffer, alloc)))
{
HeapFree(GetProcessHeap(), 0, buffer);
return -1;
}
buffer = new;
}
buffer[len++] = ch;
}
...
...
programs/winedbg/display.c
View file @
674ef559
...
...
@@ -63,10 +63,13 @@ BOOL display_add(struct expr *exp, int count, char format)
if
(
i
==
maxdisplays
)
{
struct
display
*
new
;
/* no space left - expand */
new
=
dbg_heap_realloc
(
displaypoints
,
(
maxdisplays
+
DISPTAB_DELTA
)
*
sizeof
(
*
displaypoints
));
if
(
!
new
)
return
FALSE
;
displaypoints
=
new
;
maxdisplays
+=
DISPTAB_DELTA
;
displaypoints
=
dbg_heap_realloc
(
displaypoints
,
maxdisplays
*
sizeof
(
*
displaypoints
));
}
if
(
i
==
ndisplays
)
ndisplays
++
;
...
...
programs/winedbg/info.c
View file @
674ef559
...
...
@@ -199,8 +199,10 @@ static BOOL CALLBACK info_mod_cb(PCSTR mod_name, DWORD64 base, PVOID ctx)
if
(
im
->
num_used
+
1
>
im
->
num_alloc
)
{
struct
info_module
*
new
=
dbg_heap_realloc
(
im
->
modules
,
(
im
->
num_alloc
+
16
)
*
sizeof
(
*
im
->
modules
));
if
(
!
new
)
return
FALSE
;
/* stop enumeration in case of OOM */
im
->
num_alloc
+=
16
;
im
->
modules
=
dbg_heap_realloc
(
im
->
modules
,
im
->
num_alloc
*
sizeof
(
*
im
->
modules
))
;
im
->
modules
=
new
;
}
im
->
modules
[
im
->
num_used
].
mi
.
SizeOfStruct
=
sizeof
(
im
->
modules
[
im
->
num_used
].
mi
);
if
(
SymGetModuleInfo64
(
dbg_curr_process
->
handle
,
base
,
&
im
->
modules
[
im
->
num_used
].
mi
))
...
...
@@ -315,8 +317,10 @@ static void class_walker(HWND hWnd, struct class_walker* cw)
{
if
(
cw
->
used
>=
cw
->
alloc
)
{
ATOM
*
new
=
dbg_heap_realloc
(
cw
->
table
,
(
cw
->
alloc
+
16
)
*
sizeof
(
ATOM
));
if
(
!
new
)
return
;
cw
->
alloc
+=
16
;
cw
->
table
=
dbg_heap_realloc
(
cw
->
table
,
cw
->
alloc
*
sizeof
(
ATOM
))
;
cw
->
table
=
new
;
}
cw
->
table
[
cw
->
used
++
]
=
atom
;
info_win32_class
(
hWnd
,
clsName
);
...
...
@@ -547,8 +551,15 @@ void info_win32_processes(void)
dp
.
entries
[
dp
.
count
++
].
children
=
-
1
;
if
(
dp
.
count
>=
dp
.
alloc
)
{
dp
.
entries
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
dp
.
entries
,
sizeof
(
*
dp
.
entries
)
*
(
dp
.
alloc
*=
2
));
if
(
!
dp
.
entries
)
return
;
struct
dump_proc_entry
*
new
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
dp
.
entries
,
sizeof
(
*
dp
.
entries
)
*
(
dp
.
alloc
*
2
));
if
(
!
new
)
{
CloseHandle
(
snap
);
HeapFree
(
GetProcessHeap
(),
0
,
dp
.
entries
);
return
;
}
dp
.
alloc
*=
2
;
dp
.
entries
=
new
;
}
dp
.
entries
[
dp
.
count
].
proc
.
dwSize
=
sizeof
(
dp
.
entries
[
dp
.
count
].
proc
);
ok
=
Process32Next
(
snap
,
&
dp
.
entries
[
dp
.
count
].
proc
);
...
...
programs/winedbg/stack.c
View file @
674ef559
...
...
@@ -204,8 +204,10 @@ unsigned stack_fetch_frames(const dbg_ctx_t* _ctx)
SymFunctionTableAccess64
,
SymGetModuleBase64
,
NULL
,
SYM_STKWALK_DEFAULT
))
||
nf
==
0
)
/* we always register first frame information */
{
dbg_curr_thread
->
frames
=
dbg_heap_realloc
(
dbg_curr_thread
->
frames
,
(
nf
+
1
)
*
sizeof
(
dbg_curr_thread
->
frames
[
0
]));
struct
dbg_frame
*
new
=
dbg_heap_realloc
(
dbg_curr_thread
->
frames
,
(
nf
+
1
)
*
sizeof
(
dbg_curr_thread
->
frames
[
0
]));
if
(
!
new
)
break
;
dbg_curr_thread
->
frames
=
new
;
dbg_curr_thread
->
frames
[
nf
].
addr_pc
=
sf
.
AddrPC
;
dbg_curr_thread
->
frames
[
nf
].
linear_pc
=
(
DWORD_PTR
)
memory_to_linear_addr
(
&
sf
.
AddrPC
);
...
...
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