[10/11] windowscodecs: Handle IFD fields with count 0 same way as with count 1. Resend.
Dmitry Timoshkov
dmitry at baikal.ru
Wed Jun 13 04:31:49 CDT 2012
---
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 81ad787..a65de1b 100644
--- a/dlls/windowscodecs/metadatahandler.c
+++ b/dlls/windowscodecs/metadatahandler.c
@@ -682,6 +682,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 *)&value;
@@ -719,6 +721,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 *)&value;
@@ -761,6 +765,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;
@@ -791,6 +797,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)
{
struct IFD_rational rational;
@@ -835,6 +848,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 386d119..65174d0 100644
--- a/dlls/windowscodecs/tests/metadata.c
+++ b/dlls/windowscodecs/tests/metadata.c
@@ -77,7 +77,7 @@ static const struct
char string[13];
} IFD_data =
{
- 22,
+ 26,
{
{ 0xfe, IFD_SHORT, 1, 1 }, /* NEWSUBFILETYPE */
{ 0x100, IFD_LONG, 1, 222 }, /* IMAGEWIDTH */
@@ -110,6 +110,10 @@ static const struct
{ 0xf00f, IFD_ASCII, 4, 'a' | 'b' << 8 | 'c' << 16 | 'd' << 24 },
{ 0xf010, IFD_UNDEFINED, 13,
sizeof(USHORT) + sizeof(struct IFD_entry) * 40 + sizeof(ULONG) + sizeof(struct IFD_rational) },
+ { 0xf011, IFD_BYTE, 0, 0x11223344 },
+ { 0xf012, IFD_SHORT, 0, 0x11223344 },
+ { 0xf013, IFD_LONG, 0, 0x11223344 },
+ { 0xf014, IFD_FLOAT, 0, 0x11223344 },
},
0,
{ 900, 3 },
@@ -388,7 +392,7 @@ static void test_metadata_IFD(void)
int count; /* if VT_VECTOR */
LONGLONG value[13];
const char *string;
- } td[22] =
+ } td[26] =
{
{ VT_UI2, 0xfe, 0, { 1 } },
{ VT_UI4, 0x100, 0, { 222 } },
@@ -412,6 +416,10 @@ static void test_metadata_IFD(void)
{ VT_R4|VT_VECTOR, 0xf00e, 2, { 900, 3 } },
{ VT_LPSTR, 0xf00f, 4, { 0 }, "abcd" },
{ VT_BLOB, 0xf010, 13, { 0 }, "Hello World!" },
+ { VT_UI1, 0xf011, 0, { 0x44 } },
+ { VT_UI2, 0xf012, 0, { 0x3344 } },
+ { VT_UI4, 0xf013, 0, { 0x11223344 } },
+ { VT_R4, 0xf014, 0, { 0x11223344 } },
};
HRESULT hr;
IWICMetadataReader *reader;
--
1.7.10.1
More information about the wine-patches
mailing list