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
88a5c64b
Commit
88a5c64b
authored
Dec 11, 2022
by
Alex Henrie
Committed by
Alexandre Julliard
Jan 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hhctrl: Handle memory allocation failure in ReadChmSystem (cppcheck).
parent
7a441eaf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
chm.c
dlls/hhctrl.ocx/chm.c
+16
-5
No files found.
dlls/hhctrl.ocx/chm.c
View file @
88a5c64b
...
...
@@ -82,7 +82,7 @@ static BOOL ReadChmSystem(CHMInfo *chm)
{
IStream
*
stream
;
DWORD
ver
=
0xdeadbeef
,
read
,
buf_size
;
char
*
buf
;
char
*
buf
,
*
new_buf
;
HRESULT
hres
;
struct
{
...
...
@@ -101,16 +101,27 @@ static BOOL ReadChmSystem(CHMInfo *chm)
IStream_Read
(
stream
,
&
ver
,
sizeof
(
ver
),
&
read
);
TRACE
(
"version is %lx
\n
"
,
ver
);
buf
=
malloc
(
8
*
sizeof
(
DWORD
));
buf_size
=
8
*
sizeof
(
DWORD
);
buf_size
=
8
*
sizeof
(
DWORD
);
buf
=
malloc
(
buf_size
);
if
(
!
buf
)
{
IStream_Release
(
stream
);
return
FALSE
;
}
while
(
1
)
{
hres
=
IStream_Read
(
stream
,
&
entry
,
sizeof
(
entry
),
&
read
);
if
(
hres
!=
S_OK
)
break
;
if
(
entry
.
len
>
buf_size
)
buf
=
realloc
(
buf
,
buf_size
=
entry
.
len
);
if
(
entry
.
len
>
buf_size
)
{
new_buf
=
realloc
(
buf
,
entry
.
len
);
if
(
!
new_buf
)
{
hres
=
E_OUTOFMEMORY
;
break
;
}
buf
=
new_buf
;
buf_size
=
entry
.
len
;
}
hres
=
IStream_Read
(
stream
,
buf
,
entry
.
len
,
&
read
);
if
(
hres
!=
S_OK
)
...
...
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