Subject: winex/windows cursoricon.c,1.12,1.13Update of /var/lib/cvsd/cvsroot/winex/windows
In directory agravaine:/tmp/cvs-serv31745/windows
Modified Files:
cursoricon.c
Log Message:
- fixed a virtual memory leak when loading animated cursors from a file. The mapped file pointer was being modified, then the UnmapViewOfFile() call was failing on the modified address.
Index: cursoricon.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/windows/cursoricon.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cursoricon.c 29 Dec 2005 16:53:42 -0000 1.12
+++ cursoricon.c 27 Apr 2007 13:16:36 -0000 1.13
@@ -377,34 +377,38 @@
{
LPBYTE _free;
CURSORICONFILEDIR *bits;
+ CURSORICONFILEDIR *originalBits;
int entries, size, i;
*res = NULL;
*ptr = NULL;
- if (!(bits = map_fileW( filename ))) return FALSE;
+
+ originalBits = bits = map_fileW( filename );
+ if (bits == NULL) return FALSE;
/* FIXME: test for inimated icons
* hack to load the first icon from the *.ani file
*/
- if ( *(LPDWORD)bits==0x46464952 ) /* "RIFF" */
- { LPBYTE pos = (LPBYTE) bits;
- FIXME_(cursor)("Animated icons not correctly implemented! %p \n", bits);
+ if ( *(LPDWORD)bits==0x46464952 ){ /* "RIFF" */
+ LPBYTE pos = (LPBYTE) bits;
+ FIXME_(cursor)("Animated icons not correctly implemented! %p \n", bits);
- for (;;)
- { if (*(LPDWORD)pos==0x6e6f6369) /* "icon" */
- { FIXME_(cursor)("icon entry found! %p\n", bits);
- pos+=4;
- if ( !*(LPWORD) pos==0x2fe) /* iconsize */
- { goto fail;
- }
- bits=(CURSORICONFILEDIR*)(pos+4);
- FIXME_(cursor)("icon size ok. offset=%p \n", bits);
- break;
- }
- pos+=2;
- if (pos>=(LPBYTE)bits+766) goto fail;
- }
+ for (;;){
+ if (*(LPDWORD)pos==0x6e6f6369){ /* "icon" */
+ FIXME_(cursor)("icon entry found! %p\n", bits);
+ pos+=4;
+ if ( !*(LPWORD) pos==0x2fe){ /* iconsize */
+ goto fail;
+ }
+ bits=(CURSORICONFILEDIR*)(pos+4);
+ FIXME_(cursor)("icon size ok. offset=%p \n", bits);
+ break;
+ }
+ pos+=2;
+ if (pos>=(LPBYTE)bits+766) goto fail;
+ }
}
+
if (!(entries = bits->idCount)) goto fail;
size = sizeof(CURSORICONDIR) + sizeof(CURSORICONDIRENTRY) * (entries - 1);
_free = (LPBYTE) size;
@@ -442,12 +446,12 @@
(*res)->idEntries[i].dwBytesInRes);
_free += (*res)->idEntries[i].dwBytesInRes;
}
- UnmapViewOfFile( bits );
+ UnmapViewOfFile( originalBits );
return TRUE;
fail:
if (*res) HeapFree( GetProcessHeap(), 0, *res );
if (*ptr) HeapFree( GetProcessHeap(), 0, *ptr );
- UnmapViewOfFile( bits );
+ UnmapViewOfFile( originalBits );
return FALSE;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.