mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-11 02:07:09 -06:00
9.15
This commit is contained in:
committed by
Kornel Lesiński
parent
708873490e
commit
e279500d76
@@ -391,7 +391,6 @@ STDMETHODIMP CHandler::Open(IInStream *inStream,
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
Close();
|
||||
try
|
||||
{
|
||||
CMyComPtr<IArchiveOpenVolumeCallback> openVolumeCallback;
|
||||
|
||||
@@ -488,10 +487,6 @@ STDMETHODIMP CHandler::Open(IInStream *inStream,
|
||||
|
||||
_xmlInComments = (_xmls.Size() == 1 && !_db.ShowImageNumber);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
return S_OK;
|
||||
COM_TRY_END
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ static size_t WriteItem(const CUpdateItem &item, Byte *p, const Byte *hash)
|
||||
return totalLen;
|
||||
}
|
||||
|
||||
void WriteTree(const CDir &tree, CRecordVector<CSha1Hash> &digests,
|
||||
static void WriteTree(const CDir &tree, CRecordVector<CSha1Hash> &digests,
|
||||
CUpdateItem &defaultDirItem,
|
||||
CObjectVector<CUpdateItem> &updateItems, Byte *dest, size_t &pos)
|
||||
{
|
||||
@@ -488,11 +488,15 @@ static HRESULT UpdateArchive(ISequentialOutStream *seqOutStream,
|
||||
const UInt32 kSecuritySize = 8;
|
||||
size_t pos = kSecuritySize;
|
||||
WriteTree(rootFolder, hashes.Digests, ri, updateItems, NULL, pos);
|
||||
|
||||
CByteBuffer meta;
|
||||
meta.SetCapacity(pos);
|
||||
// memset(meta, 0, kSecuritySize);
|
||||
Set32((Byte *)meta, 0); // only if there is no security data, we can use 0 here.
|
||||
|
||||
// we can write 0 here only if there is no security data, imageX does it,
|
||||
// but some programs expect size = 8
|
||||
Set32((Byte *)meta, 8); // size of security data
|
||||
Set32((Byte *)meta + 4, 0); // num security entries
|
||||
|
||||
pos = kSecuritySize;
|
||||
WriteTree(rootFolder, hashes.Digests, ri, updateItems, (Byte *)meta, pos);
|
||||
|
||||
|
||||
@@ -384,7 +384,12 @@ HRESULT CDatabase::ParseDirItem(size_t pos, int parent)
|
||||
return S_FALSE;
|
||||
|
||||
UInt32 fileNameLen = Get16(p + 0x24);
|
||||
if ((fileNameLen & 1) != 0 || ((0x26 + fileNameLen + 6) & ~7) != len)
|
||||
if ((fileNameLen & 1) != 0)
|
||||
return S_FALSE;
|
||||
/* Probably different versions of ImageX can use different number of
|
||||
additional ZEROs. So we don't use exact check. */
|
||||
UInt32 fileNameLen2 = (fileNameLen == 0 ? fileNameLen : fileNameLen + 2);
|
||||
if (((0x26 + fileNameLen2 + 6) & ~7) > len)
|
||||
return S_FALSE;
|
||||
|
||||
UString name;
|
||||
|
||||
Reference in New Issue
Block a user