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
51a3bc2d
Commit
51a3bc2d
authored
Jul 13, 2015
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jul 14, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs/tests: Add some tests for loading truncated GIF images.
parent
f78a6dd1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
108 additions
and
6 deletions
+108
-6
gifformat.c
dlls/windowscodecs/gifformat.c
+6
-2
gifformat.c
dlls/windowscodecs/tests/gifformat.c
+102
-4
No files found.
dlls/windowscodecs/gifformat.c
View file @
51a3bc2d
...
...
@@ -1055,10 +1055,13 @@ static ULONG WINAPI GifDecoder_Release(IWICBitmapDecoder *iface)
if
(
ref
==
0
)
{
IStream_Release
(
This
->
stream
);
if
(
This
->
stream
)
{
IStream_Release
(
This
->
stream
);
DGifCloseFile
(
This
->
gif
);
}
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
DGifCloseFile
(
This
->
gif
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -1435,6 +1438,7 @@ HRESULT GifDecoder_CreateInstance(REFIID iid, void** ppv)
This
->
IWICBitmapDecoder_iface
.
lpVtbl
=
&
GifDecoder_Vtbl
;
This
->
IWICMetadataBlockReader_iface
.
lpVtbl
=
&
GifDecoder_BlockVtbl
;
This
->
stream
=
NULL
;
This
->
ref
=
1
;
This
->
initialized
=
FALSE
;
This
->
gif
=
NULL
;
...
...
dlls/windowscodecs/tests/gifformat.c
View file @
51a3bc2d
...
...
@@ -80,15 +80,12 @@ static const char gif_frame_sizes[] = {
static
IWICImagingFactory
*
factory
;
static
I
WICBitmapDecoder
*
create_decoder
(
const
void
*
image_data
,
UINT
image_size
)
static
I
Stream
*
create_stream
(
const
void
*
image_data
,
UINT
image_size
)
{
HGLOBAL
hmem
;
BYTE
*
data
;
HRESULT
hr
;
IWICBitmapDecoder
*
decoder
=
NULL
;
IStream
*
stream
;
GUID
format
;
LONG
refcount
;
hmem
=
GlobalAlloc
(
0
,
image_size
);
data
=
GlobalLock
(
hmem
);
...
...
@@ -98,6 +95,20 @@ static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size
hr
=
CreateStreamOnHGlobal
(
hmem
,
TRUE
,
&
stream
);
ok
(
hr
==
S_OK
,
"CreateStreamOnHGlobal error %#x
\n
"
,
hr
);
return
stream
;
}
static
IWICBitmapDecoder
*
create_decoder
(
const
void
*
image_data
,
UINT
image_size
)
{
HRESULT
hr
;
IWICBitmapDecoder
*
decoder
;
IStream
*
stream
;
GUID
format
;
LONG
refcount
;
stream
=
create_stream
(
image_data
,
image_size
);
if
(
!
stream
)
return
NULL
;
hr
=
IWICImagingFactory_CreateDecoderFromStream
(
factory
,
stream
,
NULL
,
0
,
&
decoder
);
ok
(
hr
==
S_OK
,
"CreateDecoderFromStream error %#x
\n
"
,
hr
);
...
...
@@ -402,6 +413,92 @@ static void test_gif_frame_sizes(void)
IWICBitmapDecoder_Release
(
decoder
);
}
static
const
char
gif_with_trailer_1
[]
=
{
/* LSD */
'G'
,
'I'
,
'F'
,
'8'
,
'7'
,
'a'
,
0x01
,
0x00
,
0x01
,
0x00
,
0x80
,
0x00
,
0x00
,
/* palette */
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
/* IMD */
0x2c
,
0x00
,
0x00
,
0x00
,
0x00
,
0x01
,
0x00
,
0x01
,
0x00
,
0x00
,
/* image data */
0x02
,
0x02
,
0x44
,
0x01
,
0x00
,
0x3b
};
static
const
char
gif_with_trailer_2
[]
=
{
/* LSD */
'G'
,
'I'
,
'F'
,
'8'
,
'7'
,
'a'
,
0x01
,
0x00
,
0x01
,
0x00
,
0x00
,
0x00
,
0x00
,
/* IMD */
0x2c
,
0x00
,
0x00
,
0x00
,
0x00
,
0x01
,
0x00
,
0x01
,
0x00
,
0x00
,
/* image data */
0x02
,
0x02
,
0x44
,
0x3b
};
static
const
char
gif_without_trailer_1
[]
=
{
/* LSD */
'G'
,
'I'
,
'F'
,
'8'
,
'7'
,
'a'
,
0x01
,
0x00
,
0x01
,
0x00
,
0x80
,
0x00
,
0x00
,
/* palette */
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
/* IMD */
0x2c
,
0x00
,
0x00
,
0x00
,
0x00
,
0x01
,
0x00
,
0x01
,
0x00
,
0x00
,
/* image data */
0x02
,
0x02
,
0x44
,
0xde
,
0xad
,
0xbe
,
0xef
,
0xde
,
0xad
,
0xbe
,
0xef
};
static
const
char
gif_without_trailer_2
[]
=
{
/* LSD */
'G'
,
'I'
,
'F'
,
'8'
,
'7'
,
'a'
,
0x01
,
0x00
,
0x01
,
0x00
,
0x00
,
0x00
,
0x00
,
/* IMD */
0x2c
,
0x00
,
0x00
,
0x00
,
0x00
,
0x01
,
0x00
,
0x01
,
0x00
,
0x00
,
/* image data */
0x02
,
0x02
,
0x44
,
0xde
,
0xad
,
0xbe
,
0xef
,
0xde
,
0xad
,
0xbe
,
0xef
};
static
void
test_truncated_gif
(
void
)
{
HRESULT
hr
;
IStream
*
stream
;
IWICBitmapDecoder
*
decoder
;
GUID
format
;
stream
=
create_stream
(
gif_with_trailer_1
,
sizeof
(
gif_with_trailer_1
));
if
(
!
stream
)
return
;
hr
=
IWICImagingFactory_CreateDecoderFromStream
(
factory
,
stream
,
NULL
,
0
,
&
decoder
);
ok
(
hr
==
S_OK
,
"CreateDecoderFromStream error %#x
\n
"
,
hr
);
hr
=
IWICBitmapDecoder_GetContainerFormat
(
decoder
,
&
format
);
ok
(
hr
==
S_OK
,
"GetContainerFormat error %#x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
format
,
&
GUID_ContainerFormatGif
),
"wrong container format %s
\n
"
,
wine_dbgstr_guid
(
&
format
));
IWICBitmapDecoder_Release
(
decoder
);
IStream_Release
(
stream
);
stream
=
create_stream
(
gif_with_trailer_2
,
sizeof
(
gif_with_trailer_2
));
if
(
!
stream
)
return
;
hr
=
IWICImagingFactory_CreateDecoderFromStream
(
factory
,
stream
,
NULL
,
0
,
&
decoder
);
todo_wine
ok
(
hr
==
S_OK
,
"CreateDecoderFromStream error %#x
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
goto
skip_1
;
hr
=
IWICBitmapDecoder_GetContainerFormat
(
decoder
,
&
format
);
ok
(
hr
==
S_OK
,
"GetContainerFormat error %#x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
format
,
&
GUID_ContainerFormatGif
),
"wrong container format %s
\n
"
,
wine_dbgstr_guid
(
&
format
));
IWICBitmapDecoder_Release
(
decoder
);
skip_1:
IStream_Release
(
stream
);
stream
=
create_stream
(
gif_without_trailer_1
,
sizeof
(
gif_without_trailer_1
));
if
(
!
stream
)
return
;
hr
=
IWICImagingFactory_CreateDecoderFromStream
(
factory
,
stream
,
NULL
,
0
,
&
decoder
);
todo_wine
ok
(
hr
==
S_OK
,
"CreateDecoderFromStream error %#x
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
goto
skip_2
;
hr
=
IWICBitmapDecoder_GetContainerFormat
(
decoder
,
&
format
);
ok
(
hr
==
S_OK
,
"GetContainerFormat error %#x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
format
,
&
GUID_ContainerFormatGif
),
"wrong container format %s
\n
"
,
wine_dbgstr_guid
(
&
format
));
IWICBitmapDecoder_Release
(
decoder
);
skip_2:
IStream_Release
(
stream
);
stream
=
create_stream
(
gif_without_trailer_2
,
sizeof
(
gif_without_trailer_2
));
if
(
!
stream
)
return
;
hr
=
IWICImagingFactory_CreateDecoderFromStream
(
factory
,
stream
,
NULL
,
0
,
&
decoder
);
todo_wine
ok
(
hr
==
S_OK
,
"CreateDecoderFromStream error %#x
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
goto
skip_3
;
hr
=
IWICBitmapDecoder_GetContainerFormat
(
decoder
,
&
format
);
ok
(
hr
==
S_OK
,
"GetContainerFormat error %#x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
format
,
&
GUID_ContainerFormatGif
),
"wrong container format %s
\n
"
,
wine_dbgstr_guid
(
&
format
));
IWICBitmapDecoder_Release
(
decoder
);
skip_3:
IStream_Release
(
stream
);
}
START_TEST
(
gifformat
)
{
HRESULT
hr
;
...
...
@@ -428,6 +525,7 @@ START_TEST(gifformat)
test_global_gif_palette_2frames
();
test_local_gif_palette
();
test_gif_frame_sizes
();
test_truncated_gif
();
IWICImagingFactory_Release
(
factory
);
}
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