Index: vm/vmcore/include/jarfile_support.h =================================================================== --- vm/vmcore/include/jarfile_support.h (revision 601978) +++ vm/vmcore/include/jarfile_support.h (working copy) @@ -106,6 +106,10 @@ char* m_fileName; unsigned int m_relOffset; static const unsigned int sizeFixed = 30; +// CH + void *baseAddr; + long baseLength; +// CH protected: JarCompressedOffset m_contentOffset; Index: vm/vmcore/src/util/jarfile_support.cpp =================================================================== --- vm/vmcore/src/util/jarfile_support.cpp (revision 601978) +++ vm/vmcore/src/util/jarfile_support.cpp (working copy) @@ -24,6 +24,7 @@ #include #include #ifdef PLATFORM_POSIX +#include #include #endif @@ -56,14 +57,21 @@ // handle is global to all threads, and file operations like seek, // read, etc may be confused when many threads operate on the same // jar file - LMAutoUnlock lock(&jf->lock); +// LMAutoUnlock lock(&jf->lock); - if( lseek( inFile, m_contentOffset, SEEK_SET ) == -1 ) return false; +// if( lseek( inFile, m_contentOffset, SEEK_SET ) == -1 ) return false; + if ( m_contentOffset > baseLength ) return false; + unsigned char * buf1 = (unsigned char *) baseAddr + m_contentOffset; + switch( m_method ) { case JAR_FILE_STORED: - return ( read( inFile, content, m_sizeCompressed ) == m_sizeCompressed ); + memcpy( (void*)content, buf1, m_sizeCompressed); + return 1; +// return ( read( inFile, content, m_sizeCompressed ) == m_sizeCompressed ); + +// CH case JAR_FILE_SHRUNK: printf( "Found SHRUNK content. No support as of yet.\n" ); return false; @@ -91,23 +99,26 @@ return false; #else // _IPF { - unsigned char* data = (unsigned char*)STD_MALLOC(m_sizeCompressed + 1); - // FIXME: check that memory was allocated - if( read( inFile, data, m_sizeCompressed ) < m_sizeCompressed ) { - STD_FREE(data); + + unsigned char* data = (unsigned char *) buf1; + + if ( baseLength < m_sizeCompressed ) { return false; } z_stream inf; + // !!! memset( &inf, 0, sizeof(z_stream) ); + //for (i=0;i++;i