Author: spouliot
Date: 2007-03-13 21:12:53 -0500 (Tue, 13 Mar 2007)
New Revision: 74223
Modified:
trunk/libgdiplus/src/ChangeLog
trunk/libgdiplus/src/gdipImage.h
trunk/libgdiplus/src/image.c
Log:
image.c: Fix codec signature compare when more than one signature-mask exists
(e.g. GIF87 files). Fix codec signature length to match the (very large) EMF
requirement (44 bytes).
Modified: trunk/libgdiplus/src/ChangeLog
===================================================================
--- trunk/libgdiplus/src/ChangeLog 2007-03-14 00:32:48 UTC (rev 74222)
+++ trunk/libgdiplus/src/ChangeLog 2007-03-14 02:12:53 UTC (rev 74223)
@@ -1,3 +1,10 @@
+2007-03-13 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * image.c: Fix codec signature compare when more than one signature-
+ mask exists (e.g. GIF87 files). Fix codec signature length to match the
+ (very large) EMF requirement (44 bytes).
+ * gdipImage.h: Add define for MAX_CODEC_SIG_LENGTH
+
2007-03-13 Sebastien Pouliot <[EMAIL PROTECTED]>
* bitmap.c: Added comment about the special allocation of ColorPalette
Modified: trunk/libgdiplus/src/gdipImage.h
===================================================================
--- trunk/libgdiplus/src/gdipImage.h 2007-03-14 00:32:48 UTC (rev 74222)
+++ trunk/libgdiplus/src/gdipImage.h 2007-03-14 02:12:53 UTC (rev 74223)
@@ -31,6 +31,8 @@
static const CLSID gdip_image_frameDimension_resolution_guid = {0x84236f7bU,
0x3bd3U, 0x428fU, {0x8d, 0xab, 0x4e, 0xa1, 0x43, 0x9c, 0xa3, 0x15}};
+#define MAX_CODEC_SIG_LENGTH 44
+
/*
* Enumerations
*
Modified: trunk/libgdiplus/src/image.c
===================================================================
--- trunk/libgdiplus/src/image.c 2007-03-14 00:32:48 UTC (rev 74222)
+++ trunk/libgdiplus/src/image.c 2007-03-14 02:12:53 UTC (rev 74223)
@@ -77,7 +77,7 @@
for (index = 0; index < g_decoders; index++, decoder++) {
int sig;
/* for each signature in the codec */
- for (sig = 0; sig < decoder->SigCount; sig++) {
+ for (sig = 0; sig < (decoder->SigSize * decoder->SigCount); sig
+= decoder->SigSize) {
BOOL match = TRUE;
int p;
for (p = 0; ((p < decoder->SigSize) && (p <
size_read)); p++) {
@@ -677,7 +677,7 @@
GpStatus status = Ok;
ImageFormat format;
char *file_name = NULL;
- char format_peek[10];
+ char format_peek[MAX_CODEC_SIG_LENGTH];
int format_peek_sz;
if (!image || !file)
@@ -695,7 +695,7 @@
return OutOfMemory;
}
- format_peek_sz = fread (format_peek, 1, 10, fp);
+ format_peek_sz = fread (format_peek, 1, MAX_CODEC_SIG_LENGTH, fp);
format = get_image_format (format_peek, format_peek_sz);
fseek (fp, 0, SEEK_SET);
@@ -1965,10 +1965,10 @@
ImageFormat format;
dstream_t *loader = NULL;
- byte format_peek[10];
+ byte format_peek[MAX_CODEC_SIG_LENGTH];
int format_peek_sz;
- format_peek_sz = getHeaderFunc (format_peek, 10);
+ format_peek_sz = getHeaderFunc (format_peek, MAX_CODEC_SIG_LENGTH);
format = get_image_format ((char *)format_peek, format_peek_sz);
switch (format) {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches