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
36e5836e
Commit
36e5836e
authored
Jul 23, 2023
by
Jeff Smith
Committed by
Alexandre Julliard
Jul 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: PROPVARIANT fields should use CoTaskMem allocation.
parent
c77642ec
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
81 deletions
+72
-81
gifformat.c
dlls/windowscodecs/gifformat.c
+40
-47
metadatahandler.c
dlls/windowscodecs/metadatahandler.c
+23
-23
pngformat.c
dlls/windowscodecs/pngformat.c
+9
-11
No files found.
dlls/windowscodecs/gifformat.c
View file @
36e5836e
This diff is collapsed.
Click to expand it.
dlls/windowscodecs/metadatahandler.c
View file @
36e5836e
...
...
@@ -626,21 +626,21 @@ static HRESULT LoadUnknownMetadata(IStream *input, const GUID *preferred_vendor,
if
(
FAILED
(
hr
))
return
hr
;
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
stat
.
cbSize
.
QuadPart
);
data
=
CoTaskMemAlloc
(
stat
.
cbSize
.
QuadPart
);
if
(
!
data
)
return
E_OUTOFMEMORY
;
hr
=
IStream_Read
(
input
,
data
,
stat
.
cbSize
.
QuadPart
,
&
bytesread
);
if
(
bytesread
!=
stat
.
cbSize
.
QuadPart
)
hr
=
E_FAIL
;
if
(
hr
!=
S_OK
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
CoTaskMemFree
(
data
);
return
hr
;
}
result
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MetadataItem
));
if
(
!
result
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
CoTaskMemFree
(
data
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -754,7 +754,7 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
{
item
->
value
.
vt
|=
VT_VECTOR
;
item
->
value
.
caub
.
cElems
=
count
;
item
->
value
.
caub
.
pElems
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
);
item
->
value
.
caub
.
pElems
=
CoTaskMemAlloc
(
count
);
memcpy
(
item
->
value
.
caub
.
pElems
,
data
,
count
);
}
break
;
...
...
@@ -762,21 +762,21 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
item
->
value
.
vt
|=
VT_VECTOR
;
item
->
value
.
caub
.
cElems
=
count
;
item
->
value
.
caub
.
pElems
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
);
item
->
value
.
caub
.
pElems
=
CoTaskMemAlloc
(
count
);
if
(
!
item
->
value
.
caub
.
pElems
)
return
E_OUTOFMEMORY
;
pos
.
QuadPart
=
value
;
hr
=
IStream_Seek
(
input
,
pos
,
SEEK_SET
,
NULL
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
item
->
value
.
caub
.
pElems
);
CoTaskMemFree
(
item
->
value
.
caub
.
pElems
);
return
hr
;
}
hr
=
IStream_Read
(
input
,
item
->
value
.
caub
.
pElems
,
count
,
&
bytesread
);
if
(
bytesread
!=
count
)
hr
=
E_FAIL
;
if
(
hr
!=
S_OK
)
{
HeapFree
(
GetProcessHeap
(),
0
,
item
->
value
.
caub
.
pElems
);
CoTaskMemFree
(
item
->
value
.
caub
.
pElems
);
return
hr
;
}
break
;
...
...
@@ -797,7 +797,7 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
{
item
->
value
.
vt
|=
VT_VECTOR
;
item
->
value
.
caui
.
cElems
=
count
;
item
->
value
.
caui
.
pElems
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
*
2
);
item
->
value
.
caui
.
pElems
=
CoTaskMemAlloc
(
count
*
2
);
memcpy
(
item
->
value
.
caui
.
pElems
,
data
,
count
*
2
);
for
(
i
=
0
;
i
<
count
;
i
++
)
SWAP_USHORT
(
item
->
value
.
caui
.
pElems
[
i
]);
...
...
@@ -807,21 +807,21 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
item
->
value
.
vt
|=
VT_VECTOR
;
item
->
value
.
caui
.
cElems
=
count
;
item
->
value
.
caui
.
pElems
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
*
2
);
item
->
value
.
caui
.
pElems
=
CoTaskMemAlloc
(
count
*
2
);
if
(
!
item
->
value
.
caui
.
pElems
)
return
E_OUTOFMEMORY
;
pos
.
QuadPart
=
value
;
hr
=
IStream_Seek
(
input
,
pos
,
SEEK_SET
,
NULL
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
item
->
value
.
caui
.
pElems
);
CoTaskMemFree
(
item
->
value
.
caui
.
pElems
);
return
hr
;
}
hr
=
IStream_Read
(
input
,
item
->
value
.
caui
.
pElems
,
count
*
2
,
&
bytesread
);
if
(
bytesread
!=
count
*
2
)
hr
=
E_FAIL
;
if
(
hr
!=
S_OK
)
{
HeapFree
(
GetProcessHeap
(),
0
,
item
->
value
.
caui
.
pElems
);
CoTaskMemFree
(
item
->
value
.
caui
.
pElems
);
return
hr
;
}
for
(
i
=
0
;
i
<
count
;
i
++
)
...
...
@@ -840,21 +840,21 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
item
->
value
.
vt
|=
VT_VECTOR
;
item
->
value
.
caul
.
cElems
=
count
;
item
->
value
.
caul
.
pElems
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
*
4
);
item
->
value
.
caul
.
pElems
=
CoTaskMemAlloc
(
count
*
4
);
if
(
!
item
->
value
.
caul
.
pElems
)
return
E_OUTOFMEMORY
;
pos
.
QuadPart
=
value
;
hr
=
IStream_Seek
(
input
,
pos
,
SEEK_SET
,
NULL
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
item
->
value
.
caul
.
pElems
);
CoTaskMemFree
(
item
->
value
.
caul
.
pElems
);
return
hr
;
}
hr
=
IStream_Read
(
input
,
item
->
value
.
caul
.
pElems
,
count
*
4
,
&
bytesread
);
if
(
bytesread
!=
count
*
4
)
hr
=
E_FAIL
;
if
(
hr
!=
S_OK
)
{
HeapFree
(
GetProcessHeap
(),
0
,
item
->
value
.
caul
.
pElems
);
CoTaskMemFree
(
item
->
value
.
caul
.
pElems
);
return
hr
;
}
for
(
i
=
0
;
i
<
count
;
i
++
)
...
...
@@ -897,21 +897,21 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
{
item
->
value
.
vt
|=
VT_VECTOR
;
item
->
value
.
cauh
.
cElems
=
count
;
item
->
value
.
cauh
.
pElems
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
*
8
);
item
->
value
.
cauh
.
pElems
=
CoTaskMemAlloc
(
count
*
8
);
if
(
!
item
->
value
.
cauh
.
pElems
)
return
E_OUTOFMEMORY
;
pos
.
QuadPart
=
value
;
hr
=
IStream_Seek
(
input
,
pos
,
SEEK_SET
,
NULL
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
item
->
value
.
cauh
.
pElems
);
CoTaskMemFree
(
item
->
value
.
cauh
.
pElems
);
return
hr
;
}
hr
=
IStream_Read
(
input
,
item
->
value
.
cauh
.
pElems
,
count
*
8
,
&
bytesread
);
if
(
bytesread
!=
count
*
8
)
hr
=
E_FAIL
;
if
(
hr
!=
S_OK
)
{
HeapFree
(
GetProcessHeap
(),
0
,
item
->
value
.
cauh
.
pElems
);
CoTaskMemFree
(
item
->
value
.
cauh
.
pElems
);
return
hr
;
}
for
(
i
=
0
;
i
<
count
;
i
++
)
...
...
@@ -927,7 +927,7 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
}
break
;
case
IFD_ASCII
:
item
->
value
.
pszVal
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
+
1
);
item
->
value
.
pszVal
=
CoTaskMemAlloc
(
count
+
1
);
if
(
!
item
->
value
.
pszVal
)
return
E_OUTOFMEMORY
;
if
(
count
<=
4
)
...
...
@@ -942,14 +942,14 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
hr
=
IStream_Seek
(
input
,
pos
,
SEEK_SET
,
NULL
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
item
->
value
.
pszVal
);
CoTaskMemFree
(
item
->
value
.
pszVal
);
return
hr
;
}
hr
=
IStream_Read
(
input
,
item
->
value
.
pszVal
,
count
,
&
bytesread
);
if
(
bytesread
!=
count
)
hr
=
E_FAIL
;
if
(
hr
!=
S_OK
)
{
HeapFree
(
GetProcessHeap
(),
0
,
item
->
value
.
pszVal
);
CoTaskMemFree
(
item
->
value
.
pszVal
);
return
hr
;
}
item
->
value
.
pszVal
[
count
]
=
0
;
...
...
@@ -962,7 +962,7 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
break
;
}
item
->
value
.
blob
.
pBlobData
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
);
item
->
value
.
blob
.
pBlobData
=
CoTaskMemAlloc
(
count
);
if
(
!
item
->
value
.
blob
.
pBlobData
)
return
E_OUTOFMEMORY
;
item
->
value
.
blob
.
cbSize
=
count
;
...
...
@@ -978,14 +978,14 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
hr
=
IStream_Seek
(
input
,
pos
,
SEEK_SET
,
NULL
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
item
->
value
.
blob
.
pBlobData
);
CoTaskMemFree
(
item
->
value
.
blob
.
pBlobData
);
return
hr
;
}
hr
=
IStream_Read
(
input
,
item
->
value
.
blob
.
pBlobData
,
count
,
&
bytesread
);
if
(
bytesread
!=
count
)
hr
=
E_FAIL
;
if
(
hr
!=
S_OK
)
{
HeapFree
(
GetProcessHeap
(),
0
,
item
->
value
.
blob
.
pBlobData
);
CoTaskMemFree
(
item
->
value
.
blob
.
pBlobData
);
return
hr
;
}
break
;
...
...
dlls/windowscodecs/pngformat.c
View file @
36e5836e
...
...
@@ -25,6 +25,7 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "shlwapi.h"
#include "wincodecs_private.h"
...
...
@@ -63,14 +64,14 @@ static HRESULT LoadTextMetadata(IStream *stream, const GUID *preferred_vendor,
value_len
=
data_size
-
name_len
-
1
;
result
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MetadataItem
));
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
name_len
+
1
);
value
=
HeapAlloc
(
GetProcessHeap
(),
0
,
value_len
+
1
);
name
=
CoTaskMemAlloc
(
name_len
+
1
);
value
=
CoTaskMemAlloc
(
value_len
+
1
);
if
(
!
result
||
!
name
||
!
value
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
HeapFree
(
GetProcessHeap
(),
0
,
result
);
HeapFree
(
GetProcessHeap
(),
0
,
name
);
HeapFree
(
GetProcessHeap
(),
0
,
value
);
CoTaskMemFree
(
name
);
CoTaskMemFree
(
value
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -131,11 +132,11 @@ static HRESULT LoadGamaMetadata(IStream *stream, const GUID *preferred_vendor,
HeapFree
(
GetProcessHeap
(),
0
,
data
);
result
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MetadataItem
));
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
L"ImageGamma"
)
);
SHStrDupW
(
L"ImageGamma"
,
&
name
);
if
(
!
result
||
!
name
)
{
HeapFree
(
GetProcessHeap
(),
0
,
result
);
HeapFree
(
GetProcessHeap
(),
0
,
name
);
CoTaskMemFree
(
name
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -143,8 +144,6 @@ static HRESULT LoadGamaMetadata(IStream *stream, const GUID *preferred_vendor,
PropVariantInit
(
&
result
[
0
].
id
);
PropVariantInit
(
&
result
[
0
].
value
);
memcpy
(
name
,
L"ImageGamma"
,
sizeof
(
L"ImageGamma"
));
result
[
0
].
id
.
vt
=
VT_LPWSTR
;
result
[
0
].
id
.
pwszVal
=
name
;
result
[
0
].
value
.
vt
=
VT_UI4
;
...
...
@@ -200,14 +199,14 @@ static HRESULT LoadChrmMetadata(IStream *stream, const GUID *preferred_vendor,
result
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MetadataItem
)
*
8
);
for
(
i
=
0
;
i
<
8
;
i
++
)
{
dyn_names
[
i
]
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
(
lstrlenW
(
names
[
i
])
+
1
)
);
SHStrDupW
(
names
[
i
],
&
dyn_names
[
i
]
);
if
(
!
dyn_names
[
i
])
break
;
}
if
(
!
result
||
i
<
8
)
{
HeapFree
(
GetProcessHeap
(),
0
,
result
);
for
(
i
=
0
;
i
<
8
;
i
++
)
HeapFree
(
GetProcessHeap
(),
0
,
dyn_names
[
i
]);
CoTaskMemFree
(
dyn_names
[
i
]);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -219,7 +218,6 @@ static HRESULT LoadChrmMetadata(IStream *stream, const GUID *preferred_vendor,
PropVariantInit
(
&
result
[
i
].
id
);
result
[
i
].
id
.
vt
=
VT_LPWSTR
;
result
[
i
].
id
.
pwszVal
=
dyn_names
[
i
];
lstrcpyW
(
dyn_names
[
i
],
names
[
i
]);
PropVariantInit
(
&
result
[
i
].
value
);
result
[
i
].
value
.
vt
=
VT_UI4
;
...
...
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