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
e7a608a4
Commit
e7a608a4
authored
Mar 06, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 09, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpcrt4: Handle memory allocation error when creating OLE stream instance.
parent
3e676b20
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
17 deletions
+19
-17
ndr_ole.c
dlls/rpcrt4/ndr_ole.c
+19
-17
No files found.
dlls/rpcrt4/ndr_ole.c
View file @
e7a608a4
...
...
@@ -95,14 +95,15 @@ static HRESULT WINAPI RpcStream_QueryInterface(LPSTREAM iface,
REFIID
riid
,
LPVOID
*
obj
)
{
RpcStreamImpl
*
This
=
impl_from_IStream
(
iface
);
if
(
IsEqualGUID
(
&
IID_IUnknown
,
riid
)
||
IsEqualGUID
(
&
IID_ISequentialStream
,
riid
)
||
IsEqualGUID
(
&
IID_IStream
,
riid
))
{
*
obj
=
This
;
I
nterlockedIncrement
(
&
This
->
RefCount
);
*
obj
=
iface
;
I
Stream_AddRef
(
iface
);
return
S_OK
;
}
*
obj
=
NULL
;
return
E_NOINTERFACE
;
}
...
...
@@ -120,7 +121,6 @@ static ULONG WINAPI RpcStream_Release(LPSTREAM iface)
TRACE
(
"size=%d
\n
"
,
*
This
->
size
);
This
->
pMsg
->
Buffer
=
This
->
data
+
*
This
->
size
;
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
0
;
}
return
ref
;
}
...
...
@@ -212,11 +212,13 @@ static const IStreamVtbl RpcStream_Vtbl =
NULL
/* Clone */
};
static
LPSTREAM
RpcStream_Create
(
PMIDL_STUB_MESSAGE
pStubMsg
,
BOOL
init
)
static
HRESULT
RpcStream_Create
(
PMIDL_STUB_MESSAGE
pStubMsg
,
BOOL
init
,
IStream
**
stream
)
{
RpcStreamImpl
*
This
;
*
stream
=
NULL
;
This
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
RpcStreamImpl
));
if
(
!
This
)
return
NULL
;
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IStream_iface
.
lpVtbl
=
&
RpcStream_Vtbl
;
This
->
RefCount
=
1
;
This
->
pMsg
=
pStubMsg
;
...
...
@@ -225,7 +227,8 @@ static LPSTREAM RpcStream_Create(PMIDL_STUB_MESSAGE pStubMsg, BOOL init)
This
->
pos
=
0
;
if
(
init
)
*
This
->
size
=
0
;
TRACE
(
"init size=%d
\n
"
,
*
This
->
size
);
return
(
LPSTREAM
)
This
;
*
stream
=
&
This
->
IStream_iface
;
return
S_OK
;
}
static
const
IID
*
get_ip_iid
(
PMIDL_STUB_MESSAGE
pStubMsg
,
unsigned
char
*
pMemory
,
PFORMAT_STRING
pFormat
)
...
...
@@ -260,20 +263,18 @@ unsigned char * WINAPI NdrInterfacePointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg
->
MaxCount
=
0
;
if
(
!
LoadCOM
())
return
NULL
;
if
(
pStubMsg
->
Buffer
+
sizeof
(
DWORD
)
<=
(
unsigned
char
*
)
pStubMsg
->
RpcMsg
->
Buffer
+
pStubMsg
->
BufferLength
)
{
stream
=
RpcStream_Create
(
pStubMsg
,
TRUE
);
if
(
stream
)
{
hr
=
RpcStream_Create
(
pStubMsg
,
TRUE
,
&
stream
);
if
(
hr
==
S_OK
)
{
if
(
pMemory
)
hr
=
COM_MarshalInterface
(
stream
,
riid
,
(
LPUNKNOWN
)
pMemory
,
pStubMsg
->
dwDestContext
,
pStubMsg
->
pvDestContext
,
MSHLFLAGS_NORMAL
);
else
hr
=
S_OK
;
IStream_Release
(
stream
);
}
if
(
FAILED
(
hr
))
RpcRaiseException
(
hr
);
}
}
return
NULL
;
}
...
...
@@ -292,13 +293,14 @@ unsigned char * WINAPI NdrInterfacePointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg
if
(
!
LoadCOM
())
return
NULL
;
*
(
LPVOID
*
)
ppMemory
=
NULL
;
if
(
pStubMsg
->
Buffer
+
sizeof
(
DWORD
)
<
(
unsigned
char
*
)
pStubMsg
->
RpcMsg
->
Buffer
+
pStubMsg
->
BufferLength
)
{
stream
=
RpcStream_Create
(
pStubMsg
,
FALSE
);
if
(
!
stream
)
RpcRaiseException
(
E_OUTOFMEMORY
);
hr
=
RpcStream_Create
(
pStubMsg
,
FALSE
,
&
stream
);
if
(
hr
==
S_OK
)
{
if
(
*
((
RpcStreamImpl
*
)
stream
)
->
size
!=
0
)
hr
=
COM_UnmarshalInterface
(
stream
,
&
IID_NULL
,
(
LPVOID
*
)
ppMemory
);
else
hr
=
S_OK
;
IStream_Release
(
stream
);
}
if
(
FAILED
(
hr
))
RpcRaiseException
(
hr
);
}
...
...
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