Code/Framework/AzFramework/AzFramework/Archive/ZipDirCacheFactory.cpp
void CacheFactory::AddFileEntry(char* strFilePath, const ZipFile::CDRFileHeader* pFileHeader, const SExtraZipFileData& extra)
    {
        if (pFileHeader->lLocalHeaderOffset > m_CDREnd.lCDROffset)
        {
            AZ_Warning("Archive", false, "ZD_ERROR_CDR_IS_CORRUPT:"
                " Central Directory contains file descriptors pointing outside the archive file boundaries."
                " The archive file is either truncated or damaged.Please try to repair the file"); // the file offset is beyond the CDR: impossible
            return;
        }

        if ((pFileHeader->nMethod == ZipFile::METHOD_STORE || pFileHeader->nMethod == ZipFile::METHOD_STORE_AND_STREAMCIPHER_KEYTABLE) && pFileHeader->desc.lSizeUncompressed != pFileHeader->desc.lSizeCompressed)
        {
            AZ_Warning("Archive", false, "ZD_ERROR_VALIDATION_FAILED:"
                " File with STORE compression method declares its compressed size not matching its uncompressed size."
                " File descriptor is inconsistent, archive content may be damaged, please try to repair the archive");
            return;
        }

        FileEntryBase fileEntry(*pFileHeader, extra);

        InitDataOffset(fileEntry, pFileHeader);

        if (m_bBuildFileEntryMap)
        {
            m_mapFileEntries.emplace(strFilePath, fileEntry);
        }

        if (m_bBuildFileEntryTree)
        {
            m_treeFileEntries.Add(strFilePath, fileEntry);
        }
    }
//////////////////////////////////////////////////////////////////////////
// give the CDR File Header entry, reads the local file header to validate
// and determine where the actual file resides
give the CDR File Header entry, reads the local file header to validate
and determine where the actual file resides
give the CDR File Header entry reads the local file header to validate and determine where the actual file resides
void CacheFactory::AddFileEntry(char* strFilePath, const ZipFile::CDRFileHeader* pFileHeader, const SExtraZipFileData& extra)
    {
        if (pFileHeader->lLocalHeaderOffset > m_CDREnd.lCDROffset)
        {
            AZ_Warning("Archive", false, "ZD_ERROR_CDR_IS_CORRUPT:"
                " Central Directory contains file descriptors pointing outside the archive file boundaries."
                " The archive file is either truncated or damaged.Please try to repair the file"); 
            return;
        }
        if ((pFileHeader->nMethod == ZipFile::METHOD_STORE || pFileHeader->nMethod == ZipFile::METHOD_STORE_AND_STREAMCIPHER_KEYTABLE) && pFileHeader->desc.lSizeUncompressed != pFileHeader->desc.lSizeCompressed)
        {
            AZ_Warning("Archive", false, "ZD_ERROR_VALIDATION_FAILED:"
                " File with STORE compression method declares its compressed size not matching its uncompressed size."
                " File descriptor is inconsistent, archive content may be damaged, please try to repair the archive");
            return;
        }
        FileEntryBase fileEntry(*pFileHeader, extra);
        InitDataOffset(fileEntry, pFileHeader);
        if (m_bBuildFileEntryMap)
        {
            m_mapFileEntries.emplace(strFilePath, fileEntry);
        }
        if (m_bBuildFileEntryTree)
        {
            m_treeFileEntries.Add(strFilePath, fileEntry);
        }
    }
void CacheFactory :: AddFileEntry ( char * strFilePath , const ZipFile :: CDRFileHeader * pFileHeader , const SExtraZipFileData & extra ) { if ( pFileHeader -> lLocalHeaderOffset > m_CDREnd . lCDROffset ) { AZ_Warning ( " " , false , " " " " " " ) ; return ; } if ( ( pFileHeader -> nMethod == ZipFile :: METHOD_STORE || pFileHeader -> nMethod == ZipFile :: METHOD_STORE_AND_STREAMCIPHER_KEYTABLE ) && pFileHeader -> desc . lSizeUncompressed != pFileHeader -> desc . lSizeCompressed ) { AZ_Warning ( " " , false , " " " " " " ) ; return ; } FileEntryBase fileEntry ( * pFileHeader , extra ) ; InitDataOffset ( fileEntry , pFileHeader ) ; if ( m_bBuildFileEntryMap ) { m_mapFileEntries . emplace ( strFilePath , fileEntry ) ; } if ( m_bBuildFileEntryTree ) { m_treeFileEntries . Add ( strFilePath , fileEntry ) ; } }
give the CDR File Header entry, reads the local file header to validate
and determine where the actual file resides
give the CDR File Header entry reads the local file header to validate and determine where the actual file resides
// the file offset is beyond the CDR: impossible