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
d54e7cd5
Commit
d54e7cd5
authored
May 13, 2023
by
Jinoh Kang
Committed by
Alexandre Julliard
May 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
combase: Fix reading from beyond the end of a HGLOBAL stream.
parent
b3fbc16f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
hglobalstream.c
dlls/combase/hglobalstream.c
+4
-1
hglobalstream.c
dlls/ole32/tests/hglobalstream.c
+19
-0
No files found.
dlls/combase/hglobalstream.c
View file @
d54e7cd5
...
...
@@ -151,7 +151,10 @@ static HRESULT WINAPI stream_Read(IStream *iface, void *pv, ULONG cb, ULONG *rea
if
(
!
read_len
)
read_len
=
&
dummy
;
len
=
min
(
stream
->
handle
->
size
-
stream
->
position
.
u
.
LowPart
,
cb
);
if
(
stream
->
handle
->
size
>=
stream
->
position
.
u
.
LowPart
)
len
=
min
(
stream
->
handle
->
size
-
stream
->
position
.
u
.
LowPart
,
cb
);
else
len
=
0
;
buffer
=
GlobalLock
(
stream
->
handle
->
hglobal
);
if
(
!
buffer
)
...
...
dlls/ole32/tests/hglobalstream.c
View file @
d54e7cd5
...
...
@@ -65,6 +65,25 @@ static void test_streamonhglobal(void)
hr
=
IStream_Write
(
pStream
,
data
,
sizeof
(
data
),
NULL
);
ok_ole_success
(
hr
,
"IStream_Write"
);
/* Seek beyond the end of the stream and read from it */
ll
.
QuadPart
=
sizeof
(
data
)
+
16
;
hr
=
IStream_Seek
(
pStream
,
ll
,
STREAM_SEEK_SET
,
NULL
);
ok_ole_success
(
hr
,
"IStream_Seek"
);
hr
=
IStream_Read
(
pStream
,
buffer
,
sizeof
(
buffer
),
&
read
);
ok_ole_success
(
hr
,
"IStream_Read"
);
ok
(
read
==
0
,
"IStream_Read returned read %ld
\n
"
,
read
);
ull
.
u
.
HighPart
=
0xCAFECAFE
;
ull
.
u
.
LowPart
=
0xCAFECAFE
;
ll
.
u
.
HighPart
=
0
;
ll
.
u
.
LowPart
=
0
;
hr
=
IStream_Seek
(
pStream
,
ll
,
STREAM_SEEK_CUR
,
&
ull
);
ok_ole_success
(
hr
,
"IStream_Seek"
);
ok
(
ull
.
u
.
LowPart
==
sizeof
(
data
)
+
16
,
"LowPart set to %ld
\n
"
,
ull
.
u
.
LowPart
);
ok
(
ull
.
u
.
HighPart
==
0
,
"should have set HighPart to 0 instead of %ld
\n
"
,
ull
.
u
.
HighPart
);
/* Seek to the start of the stream and read from it */
ll
.
QuadPart
=
0
;
hr
=
IStream_Seek
(
pStream
,
ll
,
STREAM_SEEK_SET
,
NULL
);
ok_ole_success
(
hr
,
"IStream_Seek"
);
...
...
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