Dmitry Timoshkov : windowscodecs: Handle IFD fields with count 0 same way as with count 1.
Alexandre Julliard
julliard at winehq.org
Thu Jun 21 15:03:42 CDT 2012
Module: wine
Branch: master
Commit: b8d58650282bb3aa66515eab5ba11e16c14b95a8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b8d58650282bb3aa66515eab5ba11e16c14b95a8
Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date: Thu Jun 21 11:21:13 2012 +0900
windowscodecs: Handle IFD fields with count 0 same way as with count 1.
---
dlls/windowscodecs/metadatahandler.c | 20 ++++++++++++++++++++
dlls/windowscodecs/tests/metadata.c | 12 ++++++++++--
2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/dlls/windowscodecs/metadatahandler.c b/dlls/windowscodecs/metadatahandler.c
index f3b8d38..83b5c88 100644
--- a/dlls/windowscodecs/metadatahandler.c
+++ b/dlls/windowscodecs/metadatahandler.c
@@ -718,6 +718,8 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
{
case IFD_BYTE:
case IFD_SBYTE:
+ if (!count) count = 1;
+
if (count <= 4)
{
const BYTE *data = (const BYTE *)&entry->value;
@@ -755,6 +757,8 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
break;
case IFD_SHORT:
case IFD_SSHORT:
+ if (!count) count = 1;
+
if (count <= 2)
{
const SHORT *data = (const SHORT *)&entry->value;
@@ -800,6 +804,8 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
case IFD_LONG:
case IFD_SLONG:
case IFD_FLOAT:
+ if (!count) count = 1;
+
if (count == 1)
{
item->value.u.ulVal = value;
@@ -830,6 +836,13 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
case IFD_RATIONAL:
case IFD_SRATIONAL:
case IFD_DOUBLE:
+ if (!count)
+ {
+ FIXME("IFD field type %d, count 0\n", type);
+ item->value.vt = VT_EMPTY;
+ break;
+ }
+
if (count == 1)
{
ULONGLONG ull;
@@ -882,6 +895,13 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
item->value.u.pszVal[count] = 0;
break;
case IFD_UNDEFINED:
+ if (!count)
+ {
+ FIXME("IFD field type %d, count 0\n", type);
+ item->value.vt = VT_EMPTY;
+ break;
+ }
+
item->value.u.blob.pBlobData = HeapAlloc(GetProcessHeap(), 0, count);
if (!item->value.u.blob.pBlobData) return E_OUTOFMEMORY;
diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c
index b144ea9..1936550 100644
--- a/dlls/windowscodecs/tests/metadata.c
+++ b/dlls/windowscodecs/tests/metadata.c
@@ -82,7 +82,7 @@ static const struct ifd_data
FLOAT float_val[2];
} IFD_data =
{
- 23,
+ 27,
{
{ 0xfe, IFD_SHORT, 1, 1 }, /* NEWSUBFILETYPE */
{ 0x100, IFD_LONG, 1, 222 }, /* IMAGEWIDTH */
@@ -107,6 +107,10 @@ static const struct ifd_data
{ 0xf00f, IFD_ASCII, 4, 'a' | 'b' << 8 | 'c' << 16 | 'd' << 24 },
{ 0xf010, IFD_UNDEFINED, 13, FIELD_OFFSET(struct ifd_data, string) },
{ 0xf011, IFD_UNDEFINED, 4, 'a' | 'b' << 8 | 'c' << 16 | 'd' << 24 },
+ { 0xf012, IFD_BYTE, 0, 0x11223344 },
+ { 0xf013, IFD_SHORT, 0, 0x11223344 },
+ { 0xf014, IFD_LONG, 0, 0x11223344 },
+ { 0xf015, IFD_FLOAT, 0, 0x11223344 },
},
0,
{ 900, 3 },
@@ -390,7 +394,7 @@ static void test_metadata_IFD(void)
int count; /* if VT_VECTOR */
LONGLONG value[13];
const char *string;
- } td[23] =
+ } td[27] =
{
{ VT_UI2, 0xfe, 0, { 1 } },
{ VT_UI4, 0x100, 0, { 222 } },
@@ -415,6 +419,10 @@ static void test_metadata_IFD(void)
{ VT_LPSTR, 0xf00f, 4, { 0 }, "abcd" },
{ VT_BLOB, 0xf010, 13, { 0 }, "Hello World!" },
{ VT_BLOB, 0xf011, 4, { 0 }, "abcd" },
+ { VT_UI1, 0xf012, 0, { 0x44 } },
+ { VT_UI2, 0xf013, 0, { 0x3344 } },
+ { VT_UI4, 0xf014, 0, { 0x11223344 } },
+ { VT_R4, 0xf015, 0, { 0x11223344 } },
};
HRESULT hr;
IWICMetadataReader *reader;
More information about the wine-cvs
mailing list