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
bfed6e5f
Commit
bfed6e5f
authored
Nov 19, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Nov 19, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Add NULL pointer checks to some color context methods.
parent
b9ead1a7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
0 deletions
+31
-0
colorcontext.c
dlls/windowscodecs/colorcontext.c
+8
-0
pngformat.c
dlls/windowscodecs/pngformat.c
+2
-0
pngformat.c
dlls/windowscodecs/tests/pngformat.c
+21
-0
No files found.
dlls/windowscodecs/colorcontext.c
View file @
bfed6e5f
...
...
@@ -144,6 +144,8 @@ static HRESULT WINAPI ColorContext_GetType(IWICColorContext *iface,
ColorContext
*
This
=
impl_from_IWICColorContext
(
iface
);
TRACE
(
"(%p,%p)
\n
"
,
iface
,
pType
);
if
(
!
pType
)
return
E_INVALIDARG
;
*
pType
=
This
->
type
;
return
S_OK
;
}
...
...
@@ -157,6 +159,8 @@ static HRESULT WINAPI ColorContext_GetProfileBytes(IWICColorContext *iface,
if
(
This
->
type
!=
WICColorContextProfile
)
return
WINCODEC_ERR_NOTINITIALIZED
;
if
(
!
pcbActual
)
return
E_INVALIDARG
;
if
(
cbBuffer
>=
This
->
profile_len
&&
pbBuffer
)
memcpy
(
pbBuffer
,
This
->
profile
,
This
->
profile_len
);
...
...
@@ -171,6 +175,8 @@ static HRESULT WINAPI ColorContext_GetExifColorSpace(IWICColorContext *iface,
ColorContext
*
This
=
impl_from_IWICColorContext
(
iface
);
TRACE
(
"(%p,%p)
\n
"
,
iface
,
pValue
);
if
(
!
pValue
)
return
E_INVALIDARG
;
*
pValue
=
This
->
exif_color_space
;
return
S_OK
;
}
...
...
@@ -191,6 +197,8 @@ HRESULT ColorContext_Create(IWICColorContext **colorcontext)
{
ColorContext
*
This
;
if
(
!
colorcontext
)
return
E_INVALIDARG
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ColorContext
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
...
...
dlls/windowscodecs/pngformat.c
View file @
bfed6e5f
...
...
@@ -854,6 +854,8 @@ static HRESULT WINAPI PngDecoder_Frame_GetColorContexts(IWICBitmapFrameDecode *i
TRACE
(
"(%p,%u,%p,%p)
\n
"
,
iface
,
cCount
,
ppIColorContexts
,
pcActualCount
);
if
(
!
pcActualCount
)
return
E_INVALIDARG
;
EnterCriticalSection
(
&
This
->
lock
);
if
(
ppng_get_iCCP
(
This
->
png_ptr
,
This
->
info_ptr
,
&
name
,
&
compression_type
,
&
profile
,
&
len
))
...
...
dlls/windowscodecs/tests/pngformat.c
View file @
bfed6e5f
...
...
@@ -331,6 +331,9 @@ static void test_color_contexts(void)
ok
(
decoder
!=
0
,
"Failed to load PNG image data
\n
"
);
/* global color context */
hr
=
IWICBitmapDecoder_GetColorContexts
(
decoder
,
0
,
NULL
,
NULL
);
ok
(
hr
==
WINCODEC_ERR_UNSUPPORTEDOPERATION
,
"GetColorContexts error %#x
\n
"
,
hr
);
count
=
0xdeadbeef
;
hr
=
IWICBitmapDecoder_GetColorContexts
(
decoder
,
0
,
NULL
,
&
count
);
ok
(
hr
==
WINCODEC_ERR_UNSUPPORTEDOPERATION
,
"GetColorContexts error %#x
\n
"
,
hr
);
...
...
@@ -340,6 +343,9 @@ static void test_color_contexts(void)
hr
=
IWICBitmapDecoder_GetFrame
(
decoder
,
0
,
&
frame
);
ok
(
hr
==
S_OK
,
"GetFrame error %#x
\n
"
,
hr
);
hr
=
IWICBitmapFrameDecode_GetColorContexts
(
frame
,
0
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %#x
\n
"
,
hr
);
count
=
0xdeadbeef
;
hr
=
IWICBitmapFrameDecode_GetColorContexts
(
frame
,
0
,
NULL
,
&
count
);
ok
(
hr
==
S_OK
,
"GetColorContexts error %#x
\n
"
,
hr
);
...
...
@@ -366,19 +372,31 @@ static void test_color_contexts(void)
ok
(
hr
==
S_OK
,
"GetColorContexts error %#x
\n
"
,
hr
);
ok
(
count
==
1
,
"unexpected count %u
\n
"
,
count
);
hr
=
IWICImagingFactory_CreateColorContext
(
factory
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %#x
\n
"
,
hr
);
hr
=
IWICImagingFactory_CreateColorContext
(
factory
,
&
context
);
ok
(
hr
==
S_OK
,
"CreateColorContext error %#x
\n
"
,
hr
);
hr
=
IWICColorContext_GetType
(
context
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %#x
\n
"
,
hr
);
type
=
0xdeadbeef
;
hr
=
IWICColorContext_GetType
(
context
,
&
type
);
ok
(
hr
==
S_OK
,
"GetType error %#x
\n
"
,
hr
);
ok
(
type
==
WICColorContextUninitialized
,
"unexpected type %u
\n
"
,
type
);
hr
=
IWICColorContext_GetProfileBytes
(
context
,
0
,
NULL
,
NULL
);
ok
(
hr
==
WINCODEC_ERR_NOTINITIALIZED
,
"GetProfileBytes error %#x
\n
"
,
hr
);
size
=
0
;
hr
=
IWICColorContext_GetProfileBytes
(
context
,
0
,
NULL
,
&
size
);
ok
(
hr
==
WINCODEC_ERR_NOTINITIALIZED
,
"GetProfileBytes error %#x
\n
"
,
hr
);
ok
(
!
size
,
"unexpected size %u
\n
"
,
size
);
hr
=
IWICColorContext_GetExifColorSpace
(
context
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %#x
\n
"
,
hr
);
colorspace
=
0xdeadbeef
;
hr
=
IWICColorContext_GetExifColorSpace
(
context
,
&
colorspace
);
ok
(
hr
==
S_OK
,
"GetExifColorSpace error %#x
\n
"
,
hr
);
...
...
@@ -424,6 +442,9 @@ static void test_color_contexts(void)
hr
=
IWICBitmapFrameDecode_GetColorContexts
(
frame
,
count
,
&
context
,
&
count
);
ok
(
hr
==
S_OK
,
"GetColorContexts error %#x
\n
"
,
hr
);
hr
=
IWICColorContext_GetProfileBytes
(
context
,
0
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %#x
\n
"
,
hr
);
size
=
0
;
hr
=
IWICColorContext_GetProfileBytes
(
context
,
0
,
NULL
,
&
size
);
ok
(
hr
==
S_OK
,
"GetProfileBytes error %#x
\n
"
,
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