Package: release.debian.org
Severity: normal
Tags: bookworm
X-Debbugs-Cc: [email protected], [email protected],
[email protected], [email protected]
Control: affects -1 + src:7zip
User: [email protected]
Usertags: pu
[ Reason ]
7-Zip 26.02 was released with some undocumented vulnerabilities fix.
[ Impact ]
Some unknown vulnerabilities unfixed.
[ Tests ]
Autopkgtest was successful.
[ Risks ]
All fixes are not documented by upstream.
So, I think it needs some more review from security team for this update.
If there is no time to review this fix for last bookworm update,
I will ask LTS team to release this update for LTS update.
[ Checklist ]
[x] *all* changes are documented in the d/changelog
[x] I reviewed all changes and I approve them
[x] attach debdiff against the package in (old)stable
[x] the issue is verified as fixed in unstable
[ Changes ]
* Update to 7zip 26.02
[ Other info ]
Online diff:
*
https://salsa.debian.org/debian/7zip/-/comparedebian%2F22.01+really26.01+dfsg-0+deb12u1...debian%2Fbookworm
I also send diff files.
* /debian/ files only diffs
* all diffs
diff --git a/debian/changelog b/debian/changelog
index 57dfdba..dd59ec0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+7zip (22.01+really26.02+dfsg-0+deb12u1) bookworm; urgency=high
+
+ * New upstream version 26.02+dfsg
+ 7zip 26.02 includes some bugs/vulnerabilities fix.
+
+ -- YOKOTA Hiroshi <[email protected]> Thu, 02 Jul 2026 09:17:47 +0900
+
7zip (22.01+really26.01+dfsg-0+deb12u1) bookworm; urgency=high
* 7zip 26.01 includes these fixes:
diff -Nru 7zip-22.01+really26.01+dfsg/C/7zArcIn.c
7zip-22.01+really26.02+dfsg/C/7zArcIn.c
--- 7zip-22.01+really26.01+dfsg/C/7zArcIn.c 2026-04-28 01:31:12.000000000
+0900
+++ 7zip-22.01+really26.02+dfsg/C/7zArcIn.c 2026-06-26 15:00:29.000000000
+0900
@@ -11,7 +11,7 @@
#include "CpuArch.h"
#define MY_ALLOC(T, p, size, alloc) \
- { if ((p = (T *)ISzAlloc_Alloc(alloc, (size) * sizeof(T))) == NULL) return
SZ_ERROR_MEM; }
+ { if ((p = (T *)ISzAlloc_Alloc(alloc, (size_t)(size) * sizeof(T))) == NULL)
return SZ_ERROR_MEM; }
#define MY_ALLOC_ZE(T, p, size, alloc) \
{ if ((size) == 0) p = NULL; else MY_ALLOC(T, p, size, alloc) }
@@ -22,8 +22,6 @@
#define MY_ALLOC_ZE_AND_CPY(to, size, from, alloc) \
{ if ((size) == 0) to = NULL; else { MY_ALLOC_AND_CPY(to, size, from, alloc)
} }
-#define k7zMajorVersion 0
-
enum EIdEnum
{
k7zIdEnd,
@@ -52,15 +50,13 @@
k7zIdEncodedHeader,
k7zIdStartPos,
k7zIdDummy
- // k7zNtSecure,
- // k7zParent,
- // k7zIsReal
};
const Byte k7zSignature[k7zSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C};
#define SzBitUi32s_INIT(p) { (p)->Defs = NULL; (p)->Vals = NULL; }
+Z7_FORCE_INLINE
static SRes SzBitUi32s_Alloc(CSzBitUi32s *p, size_t num, ISzAllocPtr alloc)
{
if (num == 0)
@@ -76,6 +72,7 @@
return SZ_OK;
}
+Z7_FORCE_INLINE
static void SzBitUi32s_Free(CSzBitUi32s *p, ISzAllocPtr alloc)
{
ISzAlloc_Free(alloc, p->Defs); p->Defs = NULL;
@@ -84,13 +81,14 @@
#define SzBitUi64s_INIT(p) { (p)->Defs = NULL; (p)->Vals = NULL; }
+Z7_FORCE_INLINE
static void SzBitUi64s_Free(CSzBitUi64s *p, ISzAllocPtr alloc)
{
ISzAlloc_Free(alloc, p->Defs); p->Defs = NULL;
ISzAlloc_Free(alloc, p->Vals); p->Vals = NULL;
}
-
+Z7_NO_INLINE
static void SzAr_Init(CSzAr *p)
{
p->NumPackStreams = 0;
@@ -110,23 +108,22 @@
p->RangeLimit = 0;
}
+Z7_NO_INLINE
static void SzAr_Free(CSzAr *p, ISzAllocPtr alloc)
{
ISzAlloc_Free(alloc, p->PackPositions);
SzBitUi32s_Free(&p->FolderCRCs, alloc);
-
ISzAlloc_Free(alloc, p->FoCodersOffsets);
ISzAlloc_Free(alloc, p->FoStartPackStreamIndex);
ISzAlloc_Free(alloc, p->FoToCoderUnpackSizes);
ISzAlloc_Free(alloc, p->FoToMainUnpackSizeIndex);
ISzAlloc_Free(alloc, p->CoderUnpackSizes);
-
ISzAlloc_Free(alloc, p->CodersData);
SzAr_Init(p);
}
-
+Z7_NO_INLINE
void SzArEx_Init(CSzArEx *p)
{
SzAr_Init(&p->db);
@@ -150,6 +147,7 @@
SzBitUi64s_INIT(&p->CTime)
}
+Z7_NO_INLINE
void SzArEx_Free(CSzArEx *p, ISzAllocPtr alloc)
{
ISzAlloc_Free(alloc, p->UnpackPositions);
@@ -172,15 +170,6 @@
}
-static int TestSignatureCandidate(const Byte *testBytes)
-{
- unsigned i;
- for (i = 0; i < k7zSignatureSize; i++)
- if (testBytes[i] != k7zSignature[i])
- return 0;
- return 1;
-}
-
#define SzData_CLEAR(p) { (p)->Data = NULL; (p)->Size = 0; }
#define SZ_READ_BYTE_SD_NOCHECK(_sd_, dest) \
@@ -199,14 +188,9 @@
#define SKIP_DATA(sd, size) { sd->Size -= (size_t)(size); sd->Data +=
(size_t)(size); }
#define SKIP_DATA2(sd, size) { sd.Size -= (size_t)(size); sd.Data +=
(size_t)(size); }
-#define SZ_READ_32(dest) if (sd.Size < 4) return SZ_ERROR_ARCHIVE; \
- dest = GetUi32(sd.Data); SKIP_DATA2(sd, 4);
-
static Z7_NO_INLINE SRes ReadNumber(CSzData *sd, UInt64 *value)
{
- Byte firstByte, mask;
- unsigned i;
- UInt32 v;
+ unsigned firstByte, mask, i, v;
SZ_READ_BYTE(firstByte)
if ((firstByte & 0x80) == 0)
@@ -223,18 +207,18 @@
SZ_READ_BYTE(mask)
*value = v | ((UInt32)mask << 8);
mask = 0x20;
- for (i = 2; i < 8; i++)
+ for (i = 2 * 8; i < 8 * 8; i += 8)
{
- Byte b;
+ unsigned b;
if ((firstByte & mask) == 0)
{
const UInt64 highPart = (unsigned)firstByte & (unsigned)(mask - 1);
- *value |= (highPart << (8 * i));
+ *value |= (highPart << i);
return SZ_OK;
}
- SZ_READ_BYTE(b)
- *value |= ((UInt64)b << (8 * i));
mask >>= 1;
+ SZ_READ_BYTE(b)
+ *value |= ((UInt64)b << i);
}
return SZ_OK;
}
@@ -242,7 +226,7 @@
static Z7_NO_INLINE SRes SzReadNumber32(CSzData *sd, UInt32 *value)
{
- Byte firstByte;
+ unsigned firstByte;
UInt64 value64;
if (sd->Size == 0)
return SZ_ERROR_ARCHIVE;
@@ -265,6 +249,7 @@
#define ReadID(sd, value) ReadNumber(sd, value)
+Z7_NO_INLINE
static SRes SkipData(CSzData *sd)
{
UInt64 size;
@@ -275,6 +260,7 @@
return SZ_OK;
}
+Z7_NO_INLINE
static SRes WaitId(CSzData *sd, UInt32 id)
{
for (;;)
@@ -289,16 +275,8 @@
}
}
-static SRes RememberBitVector(CSzData *sd, size_t numItems, const Byte **v)
-{
- const size_t numBytes = (numItems + 7) >> 3;
- if (numBytes > sd->Size)
- return SZ_ERROR_ARCHIVE;
- *v = sd->Data;
- SKIP_DATA(sd, numBytes)
- return SZ_OK;
-}
+Z7_NO_INLINE
static UInt32 CountDefinedBits(const Byte *bits, UInt32 numItems)
{
unsigned b = 0;
@@ -339,8 +317,8 @@
memset(v2, 0xFF, (size_t)numBytes);
{
const unsigned numBits = (unsigned)numItems & 7;
- if (numBits != 0)
- v2[(size_t)numBytes - 1] = (Byte)((((UInt32)1 << numBits) - 1) << (8 -
numBits));
+ if (numBits)
+ v2[(size_t)numBytes - 1] = (Byte)(0xff00u >> numBits);
}
return SZ_OK;
}
@@ -348,31 +326,40 @@
static Z7_NO_INLINE SRes ReadUi32s(CSzData *sd2, size_t numItems, CSzBitUi32s
*crcs, ISzAllocPtr alloc)
{
size_t i;
- CSzData sd;
+ const Byte *data;
+ size_t size;
UInt32 *vals;
const Byte *defs;
- MY_ALLOC_ZE(UInt32, crcs->Vals, numItems, alloc)
- sd = *sd2;
+ MY_ALLOC_ZE(UInt32, vals, numItems, alloc)
+ crcs->Vals = vals;
defs = crcs->Defs;
- vals = crcs->Vals;
+ data = sd2->Data;
+ size = sd2->Size;
for (i = 0; i < numItems; i++)
if (SzBitArray_Check(defs, i))
{
- SZ_READ_32(vals[i])
+ if (size < 4)
+ return SZ_ERROR_ARCHIVE;
+ size -= 4;
+ vals[i] = GetUi32(data);
+ data += 4;
}
else
vals[i] = 0;
- *sd2 = sd;
+ sd2->Data = data;
+ sd2->Size = size;
return SZ_OK;
}
static SRes ReadBitUi32s(CSzData *sd, size_t numItems, CSzBitUi32s *crcs,
ISzAllocPtr alloc)
{
- SzBitUi32s_Free(crcs, alloc);
+ if (crcs->Defs)
+ return SZ_ERROR_ARCHIVE;
RINOK(ReadBitVector(sd, numItems, &crcs->Defs, alloc))
return ReadUi32s(sd, numItems, crcs, alloc);
}
+Z7_NO_INLINE
static SRes SkipBitUi32s(CSzData *sd, UInt32 numItems)
{
Byte allAreDefined;
@@ -395,25 +382,26 @@
static SRes ReadPackInfo(CSzAr *p, CSzData *sd, ISzAllocPtr alloc)
{
RINOK(SzReadNumber32(sd, &p->NumPackStreams))
-
RINOK(WaitId(sd, k7zIdSize))
- MY_ALLOC(UInt64, p->PackPositions, (size_t)p->NumPackStreams + 1, alloc)
{
- UInt64 sum = 0;
- UInt32 i;
- const UInt32 numPackStreams = p->NumPackStreams;
- for (i = 0; i < numPackStreams; i++)
+ UInt64 *packPositions;
+ UInt64 sum;
+ size_t num = (size_t)p->NumPackStreams + 1;
+ MY_ALLOC(UInt64, packPositions, num, alloc)
+ p->PackPositions = packPositions;
+ sum = 0;
+ for (;;)
{
UInt64 packSize;
- p->PackPositions[i] = sum;
+ *packPositions++ = sum;
+ if (--num == 0)
+ break;
RINOK(ReadNumber(sd, &packSize))
sum += packSize;
if (sum < packSize)
return SZ_ERROR_ARCHIVE;
}
- p->PackPositions[i] = sum;
}
-
for (;;)
{
UInt64 type;
@@ -430,85 +418,79 @@
}
}
-/*
-static SRes SzReadSwitch(CSzData *sd)
-{
- Byte external;
- RINOK(SzReadByte(sd, &external));
- return (external == 0) ? SZ_OK: SZ_ERROR_UNSUPPORTED;
-}
-*/
#define k_NumCodersStreams_in_Folder_MAX (SZ_NUM_BONDS_IN_FOLDER_MAX +
SZ_NUM_PACK_STREAMS_IN_FOLDER_MAX)
SRes SzGetNextFolderItem(CSzFolder *f, CSzData *sd)
{
- UInt32 numCoders, i;
- UInt32 numInStreams = 0;
- const Byte *dataStart = sd->Data;
-
- f->NumCoders = 0;
- f->NumBonds = 0;
- f->NumPackStreams = 0;
+ UInt32 numCoders, i, numInStreams = 0;
+ const Byte * const dataStart = sd->Data;
+
+ // f->NumCoders = 0;
+ // f->NumBonds = 0;
+ // f->NumPackStreams = 0;
f->UnpackStream = 0;
RINOK(SzReadNumber32(sd, &numCoders))
if (numCoders == 0 || numCoders > SZ_NUM_CODERS_IN_FOLDER_MAX)
return SZ_ERROR_UNSUPPORTED;
+ f->NumCoders = numCoders;
for (i = 0; i < numCoders; i++)
{
Byte mainByte;
- CSzCoderInfo *coder = f->Coders + i;
- unsigned idSize, j;
- UInt64 id;
-
- SZ_READ_BYTE(mainByte)
- if ((mainByte & 0xC0) != 0)
- return SZ_ERROR_UNSUPPORTED;
-
- idSize = (unsigned)(mainByte & 0xF);
- if (idSize > sizeof(id))
- return SZ_ERROR_UNSUPPORTED;
- if (idSize > sd->Size)
- return SZ_ERROR_ARCHIVE;
- id = 0;
- for (j = 0; j < idSize; j++)
+ CSzCoderInfo *coder;
{
- id = ((id << 8) | *sd->Data);
- sd->Data++;
+ unsigned idSize, j;
+ UInt64 id;
+ const Byte *data;
+
+ if (!sd->Size)
+ return SZ_ERROR_ARCHIVE;
sd->Size--;
+ data = sd->Data;
+ mainByte = *data++;
+ if (mainByte & 0xC0)
+ return SZ_ERROR_UNSUPPORTED;
+ idSize = mainByte & 0xF;
+ if (idSize > sizeof(id))
+ return SZ_ERROR_UNSUPPORTED;
+ if (idSize > sd->Size)
+ return SZ_ERROR_ARCHIVE;
+ sd->Size -= idSize;
+ id = 0;
+ for (j = 0; j < idSize; j++)
+ id = (id << 8) | *data++;
+ sd->Data = data;
+ if (id > (UInt32)0xFFFFFFFF)
+ return SZ_ERROR_UNSUPPORTED;
+ coder = f->Coders + i;
+ coder->MethodID = (UInt32)id;
}
- if (id > (UInt32)0xFFFFFFFF)
- return SZ_ERROR_UNSUPPORTED;
- coder->MethodID = (UInt32)id;
coder->NumStreams = 1;
coder->PropsOffset = 0;
coder->PropsSize = 0;
- if ((mainByte & 0x10) != 0)
+ if (mainByte & 0x10)
{
UInt32 numStreams;
-
RINOK(SzReadNumber32(sd, &numStreams))
if (numStreams > k_NumCodersStreams_in_Folder_MAX)
return SZ_ERROR_UNSUPPORTED;
coder->NumStreams = (Byte)numStreams;
-
RINOK(SzReadNumber32(sd, &numStreams))
if (numStreams != 1)
return SZ_ERROR_UNSUPPORTED;
}
numInStreams += coder->NumStreams;
-
if (numInStreams > k_NumCodersStreams_in_Folder_MAX)
return SZ_ERROR_UNSUPPORTED;
- if ((mainByte & 0x20) != 0)
+ if (mainByte & 0x20)
{
- UInt32 propsSize = 0;
+ UInt32 propsSize;
RINOK(SzReadNumber32(sd, &propsSize))
if (propsSize > sd->Size)
return SZ_ERROR_ARCHIVE;
@@ -521,14 +503,6 @@
}
}
- /*
- if (numInStreams == 1 && numCoders == 1)
- {
- f->NumPackStreams = 1;
- f->PackStreams[0] = 0;
- }
- else
- */
{
Byte streamUsed[k_NumCodersStreams_in_Folder_MAX];
UInt32 numBonds, numPackStreams;
@@ -545,14 +519,13 @@
return SZ_ERROR_UNSUPPORTED;
f->NumPackStreams = numPackStreams;
- for (i = 0; i < numInStreams; i++)
+ for (i = 0; i < Z7_ARRAY_SIZE(streamUsed); i++) // numInStreams
streamUsed[i] = False;
- if (numBonds != 0)
+ if (numBonds)
{
Byte coderUsed[SZ_NUM_CODERS_IN_FOLDER_MAX];
-
- for (i = 0; i < numCoders; i++)
+ for (i = 0; i < Z7_ARRAY_SIZE(coderUsed); i++) // numCoders
coderUsed[i] = False;
for (i = 0; i < numBonds; i++)
@@ -570,24 +543,25 @@
coderUsed[bp->OutIndex] = True;
}
- for (i = 0; i < numCoders; i++)
+ for (i = 0;;)
+ {
if (!coderUsed[i])
- {
- f->UnpackStream = i;
break;
- }
-
- if (i == numCoders)
- return SZ_ERROR_ARCHIVE;
+ if (++i == numCoders)
+ return SZ_ERROR_ARCHIVE;
+ }
+ f->UnpackStream = i;
}
if (numPackStreams == 1)
{
- for (i = 0; i < numInStreams; i++)
+ for (i = 0;; i++)
+ {
+ if (i == numInStreams)
+ return SZ_ERROR_ARCHIVE;
if (!streamUsed[i])
break;
- if (i == numInStreams)
- return SZ_ERROR_ARCHIVE;
+ }
f->PackStreams[0] = i;
}
else
@@ -601,40 +575,30 @@
f->PackStreams[i] = index;
}
}
-
- f->NumCoders = numCoders;
-
return SZ_OK;
}
-static Z7_NO_INLINE SRes SkipNumbers(CSzData *sd2, UInt32 num)
+static SRes SkipNumbers(CSzData *sd2, UInt32 num)
{
- CSzData sd;
- sd = *sd2;
+ const Byte *data = sd2->Data;
+ size_t size = sd2->Size;
for (; num != 0; num--)
{
- Byte firstByte, mask;
+ unsigned firstByte;
unsigned i;
- SZ_READ_BYTE_2(firstByte)
- if ((firstByte & 0x80) == 0)
- continue;
- if ((firstByte & 0x40) == 0)
- {
- if (sd.Size == 0)
- return SZ_ERROR_ARCHIVE;
- sd.Size--;
- sd.Data++;
- continue;
- }
- mask = 0x20;
- for (i = 2; i < 8 && (firstByte & mask) != 0; i++)
- mask >>= 1;
- if (i > sd.Size)
+ if (size == 0)
+ return SZ_ERROR_ARCHIVE;
+ firstByte = *data;
+ for (i = 1; firstByte & 0x80; i++)
+ firstByte <<= 1;
+ if (size < i)
return SZ_ERROR_ARCHIVE;
- SKIP_DATA2(sd, i)
+ size -= i;
+ data += i;
}
- *sd2 = sd;
+ sd2->Data = data;
+ sd2->Size = size;
return SZ_OK;
}
@@ -642,15 +606,10 @@
#define k_Scan_NumCoders_MAX 64
#define k_Scan_NumCodersStreams_in_Folder_MAX 64
-
-static SRes ReadUnpackInfo(CSzAr *p,
- CSzData *sd2,
- UInt32 numFoldersMax,
- const CBuf *tempBufs, UInt32 numTempBufs,
- ISzAllocPtr alloc)
+static SRes ReadUnpackInfo(CSzAr *p, CSzData *sd2, const UInt32 numFoldersMax,
+ const CBuf *tempBufs, UInt32 numTempBufs, ISzAllocPtr alloc)
{
CSzData sd;
-
UInt32 fo, numFolders, numCodersOutStreams, packStreamIndex;
const Byte *startBufPtr;
Byte external;
@@ -742,15 +701,12 @@
{
Byte streamUsed[k_Scan_NumCodersStreams_in_Folder_MAX];
Byte coderUsed[k_Scan_NumCoders_MAX];
-
UInt32 i;
const UInt32 numBonds = numCoders - 1;
if (numInStreams < numBonds)
return SZ_ERROR_ARCHIVE;
-
if (numInStreams > k_Scan_NumCodersStreams_in_Folder_MAX)
return SZ_ERROR_UNSUPPORTED;
-
for (i = 0; i < numInStreams; i++)
streamUsed[i] = False;
for (i = 0; i < numCoders; i++)
@@ -782,16 +738,15 @@
return SZ_ERROR_ARCHIVE;
streamUsed[index] = True;
}
-
- for (i = 0; i < numCoders; i++)
+
+ for (i = 0;;)
+ {
if (!coderUsed[i])
- {
- indexOfMainStream = i;
break;
- }
-
- if (i == numCoders)
- return SZ_ERROR_ARCHIVE;
+ if (++i == numCoders)
+ return SZ_ERROR_ARCHIVE;
+ }
+ indexOfMainStream = i;
}
p->FoStartPackStreamIndex[fo] = packStreamIndex;
@@ -806,31 +761,38 @@
}
}
+ {
+ const size_t k_numCodersOutStreams_Limit = (size_t)1 << (sizeof(size_t) *
8 - 4);
+ if (numCodersOutStreams >= k_numCodersOutStreams_Limit)
+ return SZ_ERROR_UNSUPPORTED;
+ }
p->FoToCoderUnpackSizes[fo] = numCodersOutStreams;
-
+ p->FoStartPackStreamIndex[fo] = packStreamIndex;
{
const size_t dataSize = (size_t)(sd.Data - startBufPtr);
- p->FoStartPackStreamIndex[fo] = packStreamIndex;
p->FoCodersOffsets[fo] = dataSize;
MY_ALLOC_ZE_AND_CPY(p->CodersData, dataSize, startBufPtr, alloc)
}
- if (external != 0)
+ if (external)
{
- if (sd.Size != 0)
+ if (sd.Size)
return SZ_ERROR_ARCHIVE;
sd = *sd2;
}
RINOK(WaitId(&sd, k7zIdCodersUnpackSize))
-
- MY_ALLOC_ZE(UInt64, p->CoderUnpackSizes, (size_t)numCodersOutStreams, alloc)
{
- UInt32 i;
- for (i = 0; i < numCodersOutStreams; i++)
- {
- RINOK(ReadNumber(&sd, p->CoderUnpackSizes + i))
- }
+ UInt64 *sizes;
+ MY_ALLOC_ZE(UInt64, sizes, (size_t)numCodersOutStreams, alloc)
+ p->CoderUnpackSizes = sizes;
+ if (numCodersOutStreams)
+ do
+ {
+ RINOK(ReadNumber(&sd, sizes))
+ sizes++;
+ }
+ while (--numCodersOutStreams);
}
for (;;)
@@ -838,10 +800,7 @@
UInt64 type;
RINOK(ReadID(&sd, &type))
if (type == k7zIdEnd)
- {
- *sd2 = sd;
- return SZ_OK;
- }
+ break;
if (type == k7zIdCRC)
{
RINOK(ReadBitUi32s(&sd, numFolders, &p->FolderCRCs, alloc))
@@ -849,6 +808,8 @@
}
RINOK(SkipData(&sd))
}
+ *sd2 = sd;
+ return SZ_OK;
}
@@ -868,12 +829,12 @@
} CSubStreamInfo;
-static SRes ReadSubStreamsInfo(CSzAr *p, CSzData *sd, CSubStreamInfo *ssi)
+static SRes ReadSubStreamsInfo(const CSzAr *p, CSzData *sd, CSubStreamInfo
*ssi)
{
UInt64 type = 0;
- UInt32 numSubDigests = 0;
const UInt32 numFolders = p->NumFolders;
UInt32 numUnpackStreams = numFolders;
+ UInt32 numSubDigests = numFolders;
UInt32 numUnpackSizesInData = 0;
for (;;)
@@ -882,6 +843,8 @@
if (type == k7zIdNumUnpackStream)
{
UInt32 i;
+ if (ssi->sdNumSubStreams.Data)
+ return SZ_ERROR_UNSUPPORTED;
ssi->sdNumSubStreams.Data = sd->Data;
numUnpackStreams = 0;
numSubDigests = 0;
@@ -889,10 +852,10 @@
{
UInt32 numStreams;
RINOK(SzReadNumber32(sd, &numStreams))
- if (numUnpackStreams > numUnpackStreams + numStreams)
- return SZ_ERROR_UNSUPPORTED;
numUnpackStreams += numStreams;
- if (numStreams != 0)
+ if (numUnpackStreams < numStreams)
+ return SZ_ERROR_UNSUPPORTED;
+ if (numStreams)
numUnpackSizesInData += (numStreams - 1);
if (numStreams != 1 || !SzBitWithVals_Check(&p->FolderCRCs, i))
numSubDigests += numStreams;
@@ -905,12 +868,8 @@
RINOK(SkipData(sd))
}
- if (!ssi->sdNumSubStreams.Data)
- {
- numSubDigests = numFolders;
- if (p->FolderCRCs.Defs)
- numSubDigests = numFolders - CountDefinedBits(p->FolderCRCs.Defs,
numFolders);
- }
+ if (!ssi->sdNumSubStreams.Data && p->FolderCRCs.Defs)
+ numSubDigests = numFolders - CountDefinedBits(p->FolderCRCs.Defs,
numFolders);
ssi->NumTotalSubStreams = numUnpackStreams;
ssi->NumSubDigests = numSubDigests;
@@ -929,6 +888,8 @@
return SZ_OK;
if (type == k7zIdCRC)
{
+ if (ssi->sdCRCs.Data)
+ return SZ_ERROR_UNSUPPORTED;
ssi->sdCRCs.Data = sd->Data;
RINOK(SkipBitUi32s(sd, numSubDigests))
ssi->sdCRCs.Size = (size_t)(sd->Data - ssi->sdCRCs.Data);
@@ -941,9 +902,11 @@
}
}
+
static SRes SzReadStreamsInfo(CSzAr *p,
CSzData *sd,
- UInt32 numFoldersMax, const CBuf *tempBufs, UInt32 numTempBufs,
+ const UInt32 numFoldersMax,
+ const CBuf * const tempBufs, const UInt32 numTempBufs,
UInt64 *dataOffset,
CSubStreamInfo *ssi,
ISzAllocPtr alloc)
@@ -985,12 +948,13 @@
return (type == k7zIdEnd ? SZ_OK : SZ_ERROR_UNSUPPORTED);
}
+
static SRes SzReadAndDecodePackedStreams(
ILookInStreamPtr inStream,
CSzData *sd,
- CBuf *tempBufs,
- UInt32 numFoldersMax,
- UInt64 baseOffset,
+ CBuf * const tempBufs,
+ const UInt32 numFoldersMax,
+ const UInt64 baseOffset,
CSzAr *p,
ISzAllocPtr allocTemp)
{
@@ -1027,6 +991,7 @@
return SZ_OK;
}
+
// (size & 1) == 0
// (data) is aligned for 2-bytes
static SRes SzReadFileNames(const Byte *data, size_t size, UInt32 numFiles,
size_t *offsets)
@@ -1053,30 +1018,35 @@
return (p == lim) ? SZ_OK : SZ_ERROR_ARCHIVE;
}
-static Z7_NO_INLINE SRes ReadTime(CSzBitUi64s *p, size_t num,
- CSzData *sd2,
- const CBuf *tempBufs, UInt32 numTempBufs,
- ISzAllocPtr alloc)
+
+static SRes ReadTime(CSzBitUi64s *p, size_t num, CSzData *sd2,
+ const CBuf *tempBufs, UInt32 numTempBufs, ISzAllocPtr alloc)
{
- CSzData sd;
+ const Byte *data;
+ size_t size;
size_t i;
CNtfsFileTime *vals;
Byte *defs;
Byte external;
+ if (p->Defs)
+ return SZ_ERROR_ARCHIVE;
RINOK(ReadBitVector(sd2, num, &p->Defs, alloc))
SZ_READ_BYTE_SD(sd2, external)
if (external == 0)
- sd = *sd2;
+ {
+ data = sd2->Data;
+ size = sd2->Size;
+ }
else
{
UInt32 index;
RINOK(SzReadNumber32(sd2, &index))
- if (index >= numTempBufs)
+ if (index >= numTempBufs || sd2->Size)
return SZ_ERROR_ARCHIVE;
- sd.Data = tempBufs[index].data;
- sd.Size = tempBufs[index].size;
+ data = tempBufs[index].data;
+ size = tempBufs[index].size;
}
MY_ALLOC_ZE(CNtfsFileTime, p->Vals, num, alloc)
@@ -1085,18 +1055,18 @@
for (i = 0; i < num; i++)
if (SzBitArray_Check(defs, i))
{
- if (sd.Size < 8)
+ if (size < 8)
return SZ_ERROR_ARCHIVE;
- vals[i].Low = GetUi32(sd.Data);
- vals[i].High = GetUi32(sd.Data + 4);
- SKIP_DATA2(sd, 8)
+ size -= 8;
+ vals[i].Low = GetUi32(data);
+ vals[i].High = GetUi32(data + 4);
+ data += 8;
}
else
vals[i].High = vals[i].Low = 0;
- if (external == 0)
- *sd2 = sd;
-
+ if (size)
+ return SZ_ERROR_ARCHIVE;
return SZ_OK;
}
@@ -1104,16 +1074,11 @@
#define NUM_ADDITIONAL_STREAMS_MAX 8
-static SRes SzReadHeader2(
- CSzArEx *p, /* allocMain */
- CSzData *sd,
- ILookInStreamPtr inStream,
- CBuf *tempBufs, UInt32 *numTempBufs,
- ISzAllocPtr allocMain,
- ISzAllocPtr allocTemp
- )
+static SRes SzReadHeader2(CSzArEx *p, CSzData *sd, ILookInStreamPtr inStream,
+ CBuf * const tempBufs, ISzAllocPtr allocMain, ISzAllocPtr allocTemp)
{
CSubStreamInfo ssi;
+ UInt32 numTempBufs = 0;
{
UInt64 type;
@@ -1150,7 +1115,7 @@
res = SzReadAndDecodePackedStreams(inStream, sd, tempBufs,
NUM_ADDITIONAL_STREAMS_MAX,
p->startPosAfterHeader, &tempAr, allocTemp);
- *numTempBufs = tempAr.NumFolders;
+ numTempBufs = tempAr.NumFolders;
SzAr_Free(&tempAr, allocTemp);
if (res != SZ_OK)
@@ -1160,24 +1125,21 @@
if (type == k7zIdMainStreamsInfo)
{
- RINOK(SzReadStreamsInfo(&p->db, sd, (UInt32)1 << 30, tempBufs,
*numTempBufs,
+ static const UInt32 k_numFoldersMax = (UInt32)1 << 30;
+ RINOK(SzReadStreamsInfo(&p->db, sd, k_numFoldersMax, tempBufs, numTempBufs,
&p->dataPos, &ssi, allocMain))
p->dataPos += p->startPosAfterHeader;
RINOK(ReadID(sd, &type))
}
if (type == k7zIdEnd)
- {
return SZ_OK;
- }
-
if (type != k7zIdFilesInfo)
return SZ_ERROR_ARCHIVE;
}
{
- UInt32 numFiles = 0;
- UInt32 numEmptyStreams = 0;
+ UInt32 numFiles, numEmptyStreams = 0;
const Byte *emptyStreams = NULL;
const Byte *emptyFiles = NULL;
@@ -1186,44 +1148,68 @@
for (;;)
{
+ CSzData sdSwitch;
UInt64 type;
- UInt64 size;
RINOK(ReadID(sd, &type))
if (type == k7zIdEnd)
break;
- RINOK(ReadNumber(sd, &size))
- if (size > sd->Size)
- return SZ_ERROR_ARCHIVE;
-
- if (type >= ((UInt32)1 << 8))
{
+ UInt64 size;
+ RINOK(ReadNumber(sd, &size))
+ if (size > sd->Size)
+ return SZ_ERROR_ARCHIVE;
+ sdSwitch.Data = sd->Data;
+ sdSwitch.Size = (size_t)size;
SKIP_DATA(sd, size)
}
- else switch ((unsigned)type)
+ if (type >= 64)
+ continue;
+
+ switch ((unsigned)type)
{
+ case k7zIdEmptyStream:
+ {
+ if (emptyStreams || emptyFiles)
+ return SZ_ERROR_ARCHIVE;
+ if ((numFiles + 7) >> 3 != sdSwitch.Size)
+ return SZ_ERROR_ARCHIVE;
+ emptyStreams = sdSwitch.Data;
+ numEmptyStreams = CountDefinedBits(emptyStreams, numFiles);
+ break;
+ }
+
+ case k7zIdEmptyFile:
+ {
+ if (emptyFiles)
+ return SZ_ERROR_ARCHIVE;
+ if ((numEmptyStreams + 7) >> 3 != sdSwitch.Size)
+ return SZ_ERROR_ARCHIVE;
+ emptyFiles = sdSwitch.Data;
+ break;
+ }
+
case k7zIdName:
{
size_t namesSize;
const Byte *namesData;
Byte external;
-
- SZ_READ_BYTE(external)
+ if (p->FileNameOffsets)
+ return SZ_ERROR_ARCHIVE;
+ SZ_READ_BYTE_SD(&sdSwitch, external)
if (external == 0)
{
- namesSize = (size_t)size - 1;
- namesData = sd->Data;
- SKIP_DATA(sd, namesSize)
+ namesData = sdSwitch.Data;
+ namesSize = sdSwitch.Size;
}
else
{
UInt32 index;
- RINOK(SzReadNumber32(sd, &index))
- if (index >= *numTempBufs)
+ RINOK(SzReadNumber32(&sdSwitch, &index))
+ if (index >= numTempBufs || sdSwitch.Size)
return SZ_ERROR_ARCHIVE;
- namesData = (tempBufs)[index].data;
- namesSize = (tempBufs)[index].size;
+ namesData = tempBufs[index].data;
+ namesSize = tempBufs[index].size;
}
-
if (namesSize & 1)
return SZ_ERROR_ARCHIVE;
MY_ALLOC(size_t, p->FileNameOffsets, numFiles + 1, allocMain)
@@ -1231,58 +1217,38 @@
RINOK(SzReadFileNames(p->FileNames, namesSize, numFiles,
p->FileNameOffsets))
break;
}
- case k7zIdEmptyStream:
- {
- RINOK(RememberBitVector(sd, numFiles, &emptyStreams))
- numEmptyStreams = CountDefinedBits(emptyStreams, numFiles);
- emptyFiles = NULL;
- break;
- }
- case k7zIdEmptyFile:
- {
- RINOK(RememberBitVector(sd, numEmptyStreams, &emptyFiles))
- break;
- }
+
case k7zIdWinAttrib:
{
Byte external;
- CSzData sdSwitch;
- CSzData *sdPtr;
- SzBitUi32s_Free(&p->Attribs, allocMain);
- RINOK(ReadBitVector(sd, numFiles, &p->Attribs.Defs, allocMain))
-
- SZ_READ_BYTE(external)
- if (external == 0)
- sdPtr = sd;
- else
+ if (p->Attribs.Defs)
+ return SZ_ERROR_ARCHIVE;
+ RINOK(ReadBitVector(&sdSwitch, numFiles, &p->Attribs.Defs, allocMain))
+ SZ_READ_BYTE_SD(&sdSwitch, external)
+ if (external)
{
UInt32 index;
- RINOK(SzReadNumber32(sd, &index))
- if (index >= *numTempBufs)
+ RINOK(SzReadNumber32(&sdSwitch, &index))
+ if (index >= numTempBufs || sdSwitch.Size)
return SZ_ERROR_ARCHIVE;
- sdSwitch.Data = (tempBufs)[index].data;
- sdSwitch.Size = (tempBufs)[index].size;
- sdPtr = &sdSwitch;
+ sdSwitch.Data = tempBufs[index].data;
+ sdSwitch.Size = tempBufs[index].size;
}
- RINOK(ReadUi32s(sdPtr, numFiles, &p->Attribs, allocMain))
+ RINOK(ReadUi32s(&sdSwitch, numFiles, &p->Attribs, allocMain))
+ if (sdSwitch.Size)
+ return SZ_ERROR_ARCHIVE;
break;
}
- /*
- case k7zParent:
+
+ case k7zIdMTime:
+ case k7zIdCTime:
{
- SzBitUi32s_Free(&p->Parents, allocMain);
- RINOK(ReadBitVector(sd, numFiles, &p->Parents.Defs, allocMain));
- RINOK(SzReadSwitch(sd));
- RINOK(ReadUi32s(sd, numFiles, &p->Parents, allocMain));
+ RINOK(ReadTime((unsigned)type == k7zIdMTime ? &p->MTime: &p->CTime,
+ numFiles, &sdSwitch, tempBufs, numTempBufs, allocMain))
break;
}
- */
- case k7zIdMTime: RINOK(ReadTime(&p->MTime, numFiles, sd, tempBufs,
*numTempBufs, allocMain)) break;
- case k7zIdCTime: RINOK(ReadTime(&p->CTime, numFiles, sd, tempBufs,
*numTempBufs, allocMain)) break;
- default:
- {
- SKIP_DATA(sd, size)
- }
+
+ default: break;
}
}
@@ -1481,25 +1447,19 @@
ISzAllocPtr allocTemp)
{
UInt32 i;
- UInt32 numTempBufs = 0;
SRes res;
CBuf tempBufs[NUM_ADDITIONAL_STREAMS_MAX];
for (i = 0; i < NUM_ADDITIONAL_STREAMS_MAX; i++)
Buf_Init(tempBufs + i);
- res = SzReadHeader2(p, sd, inStream,
- tempBufs, &numTempBufs,
- allocMain, allocTemp);
+ res = SzReadHeader2(p, sd, inStream, tempBufs, allocMain, allocTemp);
for (i = 0; i < NUM_ADDITIONAL_STREAMS_MAX; i++)
Buf_Free(tempBufs + i, allocTemp);
- RINOK(res)
-
- if (sd->Size != 0)
- return SZ_ERROR_FAIL;
-
+ if (res == SZ_OK && sd->Size != 0)
+ return SZ_ERROR_ARCHIVE;
return res;
}
@@ -1510,53 +1470,52 @@
ISzAllocPtr allocTemp)
{
Byte header[k7zStartHeaderSize];
- Int64 startArcPos;
+ Int64 startPosAfterHeader;
UInt64 nextHeaderOffset, nextHeaderSize;
size_t nextHeaderSizeT;
UInt32 nextHeaderCRC;
CBuf buf;
SRes res;
- startArcPos = 0;
- RINOK(ILookInStream_Seek(inStream, &startArcPos, SZ_SEEK_CUR))
-
RINOK(LookInStream_Read2(inStream, header, k7zStartHeaderSize,
SZ_ERROR_NO_ARCHIVE))
-
- if (!TestSignatureCandidate(header))
- return SZ_ERROR_NO_ARCHIVE;
- if (header[6] != k7zMajorVersion)
- return SZ_ERROR_UNSUPPORTED;
+ startPosAfterHeader = 0; // k7zStartHeaderSize
+ RINOK(ILookInStream_Seek(inStream, &startPosAfterHeader, SZ_SEEK_CUR))
+ p->startPosAfterHeader = (UInt64)startPosAfterHeader;
+ {
+ unsigned i;
+ for (i = 0; i < k7zSignatureSize; i++)
+ if (header[i] != k7zSignature[i])
+ return SZ_ERROR_NO_ARCHIVE;
+ if (header[6] != 0) // k7zMajorVersion
+ return SZ_ERROR_UNSUPPORTED;
+ }
+ if (CrcCalc(header + 12, 20) != GetUi32(header + 8))
+ return SZ_ERROR_CRC;
nextHeaderOffset = GetUi64(header + 12);
nextHeaderSize = GetUi64(header + 20);
nextHeaderCRC = GetUi32(header + 28);
- p->startPosAfterHeader = (UInt64)startArcPos + k7zStartHeaderSize;
-
- if (CrcCalc(header + 12, 20) != GetUi32(header + 8))
- return SZ_ERROR_CRC;
-
p->db.RangeLimit = nextHeaderOffset;
-
+ if (nextHeaderOffset >= (UInt64)1 << 62 ||
+ nextHeaderSize >= (UInt64)1 << 48)
+ return SZ_ERROR_NO_ARCHIVE;
nextHeaderSizeT = (size_t)nextHeaderSize;
if (nextHeaderSizeT != nextHeaderSize)
return SZ_ERROR_MEM;
if (nextHeaderSizeT == 0)
+ {
+ if (nextHeaderOffset != 0 || nextHeaderCRC != 0)
+ return SZ_ERROR_NO_ARCHIVE;
return SZ_OK;
- if (nextHeaderOffset > nextHeaderOffset + nextHeaderSize ||
- nextHeaderOffset > nextHeaderOffset + nextHeaderSize +
k7zStartHeaderSize)
- return SZ_ERROR_NO_ARCHIVE;
-
+ }
{
Int64 pos = 0;
RINOK(ILookInStream_Seek(inStream, &pos, SZ_SEEK_END))
- if ((UInt64)pos < (UInt64)startArcPos + nextHeaderOffset ||
- (UInt64)pos < (UInt64)startArcPos + k7zStartHeaderSize +
nextHeaderOffset ||
- (UInt64)pos < (UInt64)startArcPos + k7zStartHeaderSize +
nextHeaderOffset + nextHeaderSize)
+ if ((UInt64)(pos - startPosAfterHeader) < nextHeaderOffset +
nextHeaderSize)
return SZ_ERROR_INPUT_EOF;
}
-
- RINOK(LookInStream_SeekTo(inStream, (UInt64)startArcPos + k7zStartHeaderSize
+ nextHeaderOffset))
+ RINOK(LookInStream_SeekTo(inStream, (UInt64)startPosAfterHeader +
nextHeaderOffset))
if (!Buf_Create(&buf, nextHeaderSizeT, allocTemp))
return SZ_ERROR_MEM;
@@ -1720,61 +1679,23 @@
size_t SzArEx_GetFileNameUtf16(const CSzArEx *p, size_t fileIndex, UInt16
*dest)
{
- const size_t offs = p->FileNameOffsets[fileIndex];
- const size_t len = p->FileNameOffsets[fileIndex + 1] - offs;
- if (dest != 0)
+ const size_t * const offsets = p->FileNameOffsets;
+ if (!offsets)
{
- size_t i;
- const Byte *src = p->FileNames + offs * 2;
- for (i = 0; i < len; i++)
- dest[i] = GetUi16(src + i * 2);
- }
- return len;
-}
-
-/*
-size_t SzArEx_GetFullNameLen(const CSzArEx *p, size_t fileIndex)
-{
- size_t len;
- if (!p->FileNameOffsets)
+ if (dest)
+ *dest = 0;
return 1;
- len = 0;
- for (;;)
- {
- UInt32 parent = (UInt32)(Int32)-1;
- len += p->FileNameOffsets[fileIndex + 1] - p->FileNameOffsets[fileIndex];
- if SzBitWithVals_Check(&p->Parents, fileIndex)
- parent = p->Parents.Vals[fileIndex];
- if (parent == (UInt32)(Int32)-1)
- return len;
- fileIndex = parent;
}
-}
-
-UInt16 *SzArEx_GetFullNameUtf16_Back(const CSzArEx *p, size_t fileIndex,
UInt16 *dest)
-{
- BoolInt needSlash;
- if (!p->FileNameOffsets)
- {
- *(--dest) = 0;
- return dest;
- }
- needSlash = False;
- for (;;)
{
- UInt32 parent = (UInt32)(Int32)-1;
- size_t curLen = p->FileNameOffsets[fileIndex + 1] -
p->FileNameOffsets[fileIndex];
- SzArEx_GetFileNameUtf16(p, fileIndex, dest - curLen);
- if (needSlash)
- *(dest - 1) = '/';
- needSlash = True;
- dest -= curLen;
-
- if SzBitWithVals_Check(&p->Parents, fileIndex)
- parent = p->Parents.Vals[fileIndex];
- if (parent == (UInt32)(Int32)-1)
- return dest;
- fileIndex = parent;
+ const size_t offs = offsets[fileIndex];
+ const size_t len = offsets[fileIndex + 1] - offs;
+ if (dest)
+ {
+ size_t i;
+ const Byte *src = p->FileNames + offs * 2;
+ for (i = 0; i < len; i++)
+ dest[i] = GetUi16a(src + i * 2);
+ }
+ return len;
}
}
-*/
diff -Nru 7zip-22.01+really26.01+dfsg/C/7zVersion.h
7zip-22.01+really26.02+dfsg/C/7zVersion.h
--- 7zip-22.01+really26.01+dfsg/C/7zVersion.h 2026-04-28 01:31:12.000000000
+0900
+++ 7zip-22.01+really26.02+dfsg/C/7zVersion.h 2026-06-26 15:00:29.000000000
+0900
@@ -1,7 +1,7 @@
#define MY_VER_MAJOR 26
-#define MY_VER_MINOR 1
+#define MY_VER_MINOR 2
#define MY_VER_BUILD 0
-#define MY_VERSION_NUMBERS "26.01"
+#define MY_VERSION_NUMBERS "26.02"
#define MY_VERSION MY_VERSION_NUMBERS
#ifdef MY_CPU_NAME
@@ -10,7 +10,7 @@
#define MY_VERSION_CPU MY_VERSION
#endif
-#define MY_DATE "2026-04-27"
+#define MY_DATE "2026-06-25"
#undef MY_COPYRIGHT
#undef MY_VERSION_COPYRIGHT_DATE
#define MY_AUTHOR_NAME "Igor Pavlov"
diff -Nru 7zip-22.01+really26.01+dfsg/C/Compiler.h
7zip-22.01+really26.02+dfsg/C/Compiler.h
--- 7zip-22.01+really26.01+dfsg/C/Compiler.h 2026-04-28 01:31:12.000000000
+0900
+++ 7zip-22.01+really26.02+dfsg/C/Compiler.h 2026-06-26 15:00:29.000000000
+0900
@@ -76,6 +76,11 @@
#pragma GCC diagnostic ignored "-Wreserved-identifier"
#endif
+#if __clang_major__ >= 22
+// for "StdAfx.h" and "Precomp.h"
+#pragma GCC diagnostic ignored "-Wshadow-header"
+#endif
+
#endif // __clang__
#if defined(__clang__) && __clang_major__ >= 16
diff -Nru 7zip-22.01+really26.01+dfsg/C/DllSecur.c
7zip-22.01+really26.02+dfsg/C/DllSecur.c
--- 7zip-22.01+really26.01+dfsg/C/DllSecur.c 2026-04-28 01:31:12.000000000
+0900
+++ 7zip-22.01+really26.02+dfsg/C/DllSecur.c 2026-06-26 15:00:29.000000000
+0900
@@ -1,5 +1,5 @@
/* DllSecur.c -- DLL loading security
-2023-12-03 : Igor Pavlov : Public domain */
+: Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -67,7 +67,7 @@
// at Vista (ver 6.0) : CoCreateInstance(CLSID_ShellLink, ...) doesn't work
after SetDefaultDllDirectories() : Check it ???
IF_NON_VISTA_SET_DLL_DIRS_AND_RETURN
{
- wchar_t buf[MAX_PATH + 100];
+ WCHAR buf[MAX_PATH + 100];
const char *dll;
unsigned pos = GetSystemDirectoryW(buf, MAX_PATH + 2);
if (pos == 0 || pos > MAX_PATH)
@@ -76,7 +76,7 @@
buf[pos++] = '\\';
for (dll = g_Dlls; *dll != 0;)
{
- wchar_t *dest = &buf[pos];
+ WCHAR *dest = &buf[pos];
for (;;)
{
const char c = *dll++;
diff -Nru 7zip-22.01+really26.01+dfsg/C/MtDec.c
7zip-22.01+really26.02+dfsg/C/MtDec.c
--- 7zip-22.01+really26.01+dfsg/C/MtDec.c 2026-04-28 01:31:12.000000000
+0900
+++ 7zip-22.01+really26.02+dfsg/C/MtDec.c 2026-06-26 15:00:29.000000000
+0900
@@ -1,5 +1,5 @@
/* MtDec.c -- Multi-thread Decoder
-2024-02-20 : Igor Pavlov : Public domain */
+: Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -22,7 +22,7 @@
#define PRF(x)
#endif
-#define PRF_STR_INT(s, d) PRF(printf("\n" s " %d\n", (unsigned)d))
+#define PRF_STR_INT(s, d) PRF(printf("\n" s " %d\n", (unsigned)d);)
void MtProgress_Init(CMtProgress *p, ICompressProgressPtr progress)
{
diff -Nru 7zip-22.01+really26.01+dfsg/C/Util/7z/7zMain.c
7zip-22.01+really26.02+dfsg/C/Util/7z/7zMain.c
--- 7zip-22.01+really26.01+dfsg/C/Util/7z/7zMain.c 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/C/Util/7z/7zMain.c 2026-06-26
15:00:29.000000000 +0900
@@ -960,7 +960,12 @@
if (listCommand == 0 && isDir && !fullPaths)
continue;
len = SzArEx_GetFileNameUtf16(&db, i, NULL);
- // len = SzArEx_GetFullNameLen(&db, i);
+
+ if (len > (1u << 20))
+ {
+ res = SZ_ERROR_UNSUPPORTED;
+ break;
+ }
if (len > tempSize)
{
diff -Nru 7zip-22.01+really26.01+dfsg/C/Util/7zipInstall/7zipInstall.c
7zip-22.01+really26.02+dfsg/C/Util/7zipInstall/7zipInstall.c
--- 7zip-22.01+really26.01+dfsg/C/Util/7zipInstall/7zipInstall.c
2026-04-28 01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/C/Util/7zipInstall/7zipInstall.c
2026-06-26 15:00:29.000000000 +0900
@@ -1,5 +1,5 @@
/* 7zipInstall.c - 7-Zip Installer
-2024-04-05 : Igor Pavlov : Public domain */
+: Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -142,7 +142,7 @@
-static void CpyAscii(wchar_t *dest, const char *s)
+static void CpyAscii(WCHAR *dest, const char *s)
{
for (;;)
{
@@ -153,13 +153,13 @@
}
}
-static void CatAscii(wchar_t *dest, const char *s)
+static void CatAscii(WCHAR *dest, const char *s)
{
dest += wcslen(dest);
CpyAscii(dest, s);
}
-static void PrintErrorMessage(const char *s1, const wchar_t *s2)
+static void PrintErrorMessage(const char *s1, const WCHAR *s2)
{
WCHAR m[MAX_PATH + 512];
m[0] = 0;
@@ -196,7 +196,7 @@
if (!g_version_dll_hModule)
{
- wchar_t buf[MAX_PATH + 100];
+ WCHAR buf[MAX_PATH + 100];
{
unsigned len = GetSystemDirectoryW(buf, MAX_PATH + 2);
if (len == 0 || len > MAX_PATH)
@@ -255,13 +255,13 @@
#define IS_LETTER_CHAR(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <=
'Z'))
#define IS_DRIVE_PATH(s) (IS_LETTER_CHAR(s[0]) && s[1] == ':' &&
IS_SEPAR(s[2]))
-static int ReverseFind_PathSepar(const wchar_t *s)
+static int ReverseFind_PathSepar(const WCHAR *s)
{
int separ = -1;
int i;
for (i = 0;; i++)
{
- wchar_t c = s[i];
+ WCHAR c = s[i];
if (c == 0)
return separ;
if (IS_SEPAR(c))
@@ -566,7 +566,7 @@
for (;; i++)
{
- const wchar_t c = s[i];
+ const WCHAR c = s[i];
if (c == 0)
break;
if (c == '/')
@@ -587,10 +587,10 @@
return c;
}
-static wchar_t MyWCharLower_Ascii(wchar_t c)
+static WCHAR MyWCharLower_Ascii(WCHAR c)
{
if (c >= 'A' && c <= 'Z')
- return (wchar_t)(c + 0x20);
+ return (WCHAR)(c + 0x20);
return c;
}
@@ -976,13 +976,13 @@
}
-static const wchar_t *GetCmdParam(const wchar_t *s)
+static const WCHAR *GetCmdParam(const WCHAR *s)
{
unsigned pos = 0;
BoolInt quoteMode = False;
for (;; s++)
{
- wchar_t c = *s;
+ WCHAR c = *s;
if (c == 0 || (c == L' ' && !quoteMode))
break;
if (c == L'\"')
@@ -999,12 +999,12 @@
}
-static void RemoveQuotes(wchar_t *s)
+static void RemoveQuotes(WCHAR *s)
{
- const wchar_t *src = s;
+ const WCHAR *src = s;
for (;;)
{
- wchar_t c = *src++;
+ WCHAR c = *src++;
if (c == '\"')
continue;
*s++ = c;
@@ -1039,7 +1039,7 @@
CrcGenerateTable();
{
- const wchar_t *s = GetCommandLineW();
+ const WCHAR *s = GetCommandLineW();
#ifndef UNDER_CE
s = GetCmdParam(s);
@@ -1048,7 +1048,7 @@
for (;;)
{
{
- const wchar_t c = *s;
+ const WCHAR c = *s;
if (c == 0)
break;
if (c == ' ')
@@ -1059,7 +1059,7 @@
}
{
- const wchar_t *s2 = GetCmdParam(s);
+ const WCHAR *s2 = GetCmdParam(s);
BoolInt error = True;
if (cmd[0] == '/')
{
@@ -1315,7 +1315,7 @@
for (;;)
{
- const wchar_t c = path[i++];
+ const WCHAR c = path[i++];
if (c == 0)
break;
if (c != ' ')
diff -Nru 7zip-22.01+really26.01+dfsg/C/Util/7zipUninstall/7zipUninstall.c
7zip-22.01+really26.02+dfsg/C/Util/7zipUninstall/7zipUninstall.c
--- 7zip-22.01+really26.01+dfsg/C/Util/7zipUninstall/7zipUninstall.c
2026-04-28 01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/C/Util/7zipUninstall/7zipUninstall.c
2026-06-26 15:00:29.000000000 +0900
@@ -1,5 +1,5 @@
/* 7zipUninstall.c - 7-Zip Uninstaller
-2024-03-21 : Igor Pavlov : Public domain */
+: Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -147,7 +147,7 @@
#define MAKE_CHAR_UPPER(c) ((((c) >= 'a' && (c) <= 'z') ? (c) - 0x20 : (c)))
-static void CpyAscii(wchar_t *dest, const char *s)
+static void CpyAscii(WCHAR *dest, const char *s)
{
for (;;)
{
@@ -158,13 +158,13 @@
}
}
-static void CatAscii(wchar_t *dest, const char *s)
+static void CatAscii(WCHAR *dest, const char *s)
{
dest += wcslen(dest);
CpyAscii(dest, s);
}
-static void PrintErrorMessage(const char *s1, const wchar_t *s2)
+static void PrintErrorMessage(const char *s1, const WCHAR *s2)
{
WCHAR m[MAX_PATH + 512];
m[0] = 0;
@@ -183,12 +183,12 @@
}
-static BoolInt AreStringsEqual_NoCase(const wchar_t *s1, const wchar_t *s2)
+static BoolInt AreStringsEqual_NoCase(const WCHAR *s1, const WCHAR *s2)
{
for (;;)
{
- wchar_t c1 = *s1++;
- wchar_t c2 = *s2++;
+ WCHAR c1 = *s1++;
+ WCHAR c2 = *s2++;
if (c1 != c2 && MAKE_CHAR_UPPER(c1) != MAKE_CHAR_UPPER(c2))
return False;
if (c2 == 0)
@@ -196,12 +196,12 @@
}
}
-static BoolInt IsString1PrefixedByString2_NoCase(const wchar_t *s1, const
wchar_t *s2)
+static BoolInt IsString1PrefixedByString2_NoCase(const WCHAR *s1, const WCHAR
*s2)
{
for (;;)
{
- wchar_t c1;
- const wchar_t c2 = *s2++;
+ WCHAR c1;
+ const WCHAR c2 = *s2++;
if (c2 == 0)
return True;
c1 = *s1++;
@@ -446,7 +446,7 @@
static LPCWSTR const k_Uninstall_7zip = k_REG_Uninstall L"7-Zip";
-static void RemoveQuotes(wchar_t *s)
+static void RemoveQuotes(WCHAR *s)
{
const size_t len = wcslen(s);
size_t i;
@@ -457,7 +457,7 @@
s[len - 2] = 0;
}
-static BoolInt AreEqual_Path_PrefixName(const wchar_t *s, const wchar_t
*prefix, const wchar_t *name)
+static BoolInt AreEqual_Path_PrefixName(const WCHAR *s, const WCHAR *prefix,
const WCHAR *name)
{
if (!IsString1PrefixedByString2_NoCase(s, prefix))
return False;
@@ -558,13 +558,13 @@
}
-static const wchar_t *GetCmdParam(const wchar_t *s)
+static const WCHAR *GetCmdParam(const WCHAR *s)
{
unsigned pos = 0;
BoolInt quoteMode = False;
for (;; s++)
{
- const wchar_t c = *s;
+ const WCHAR c = *s;
if (c == 0 || (c == L' ' && !quoteMode))
break;
if (c == L'\"')
@@ -581,12 +581,12 @@
}
/*
-static void RemoveQuotes(wchar_t *s)
+static void RemoveQuotes(WCHAR *s)
{
- const wchar_t *src = s;
+ const WCHAR *src = s;
for (;;)
{
- wchar_t c = *src++;
+ WCHAR c = *src++;
if (c == '\"')
continue;
*s++ = c;
@@ -618,11 +618,11 @@
// #define IS_LIMIT_CHAR(c) (c == 0 || c == ' ')
-static BoolInt IsThereSpace(const wchar_t *s)
+static BoolInt IsThereSpace(const WCHAR *s)
{
for (;;)
{
- const wchar_t c = *s++;
+ const WCHAR c = *s++;
if (c == 0)
return False;
if (c == ' ')
@@ -630,7 +630,7 @@
}
}
-static void AddPathParam(wchar_t *dest, const wchar_t *src)
+static void AddPathParam(WCHAR *dest, const WCHAR *src)
{
const BoolInt needQuote = IsThereSpace(src);
if (needQuote)
@@ -937,7 +937,7 @@
#endif
lpCmdLine, int nCmdShow)
{
- const wchar_t *cmdParams;
+ const WCHAR *cmdParams;
BoolInt useTemp = True;
UNUSED_VAR(hPrevInstance)
@@ -957,7 +957,7 @@
#endif
{
- const wchar_t *s = GetCommandLineW();
+ const WCHAR *s = GetCommandLineW();
#ifndef UNDER_CE
s = GetCmdParam(s);
@@ -968,7 +968,7 @@
for (;;)
{
{
- wchar_t c = *s;
+ WCHAR c = *s;
if (c == 0)
break;
if (c == ' ')
@@ -979,7 +979,7 @@
}
{
- const wchar_t *s2 = GetCmdParam(s);
+ const WCHAR *s2 = GetCmdParam(s);
BoolInt error = True;
if (cmd[0] == '/')
{
@@ -1022,7 +1022,7 @@
}
{
- wchar_t *name;
+ WCHAR *name;
const DWORD len = GetModuleFileNameW(NULL, modulePath, MAX_PATH);
if (len == 0 || len > MAX_PATH)
return 1;
@@ -1031,10 +1031,10 @@
wcscpy(modulePrefix, modulePath);
{
- wchar_t *s = modulePrefix;
+ WCHAR *s = modulePrefix;
for (;;)
{
- const wchar_t c = *s++;
+ const WCHAR c = *s++;
if (c == 0)
break;
if (c == WCHAR_PATH_SEPARATOR)
@@ -1079,14 +1079,14 @@
CpyAscii(path + pathLen, "7z");
{
- wchar_t *s = path + wcslen(path);
+ WCHAR *s = path + wcslen(path);
UInt32 value = d;
unsigned k;
for (k = 0; k < 8; k++)
{
const unsigned t = value & 0xF;
value >>= 4;
- s[7 - k] = (wchar_t)((t < 10) ? ('0' + t) : ('A' + (t - 10)));
+ s[7 - k] = (WCHAR)((t < 10) ? ('0' + t) : ('A' + (t - 10)));
}
s[k] = 0;
}
diff -Nru 7zip-22.01+really26.01+dfsg/C/Util/SfxSetup/SfxSetup.c
7zip-22.01+really26.02+dfsg/C/Util/SfxSetup/SfxSetup.c
--- 7zip-22.01+really26.01+dfsg/C/Util/SfxSetup/SfxSetup.c 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/C/Util/SfxSetup/SfxSetup.c 2026-06-26
15:00:29.000000000 +0900
@@ -1,5 +1,5 @@
/* SfxSetup.c - 7z SFX Setup
-2024-01-24 : Igor Pavlov : Public domain */
+: Igor Pavlov : Public domain */
#include "Precomp.h"
@@ -54,7 +54,7 @@
, "start"
};
-static unsigned FindExt(const wchar_t *s, unsigned *extLen)
+static unsigned FindExt(const WCHAR *s, unsigned *extLen)
{
unsigned len = (unsigned)wcslen(s);
unsigned i;
@@ -72,7 +72,7 @@
#define MAKE_CHAR_UPPER(c) ((((c) >= 'a' && (c) <= 'z') ? (c) - 0x20 : (c)))
-static unsigned FindItem(const char * const *items, unsigned num, const
wchar_t *s, unsigned len)
+static unsigned FindItem(const char * const *items, unsigned num, const WCHAR
*s, unsigned len)
{
unsigned i;
for (i = 0; i < num; i++)
@@ -268,7 +268,7 @@
#endif
size_t pathLen;
DWORD winRes;
- const wchar_t *cmdLineParams;
+ const WCHAR *cmdLineParams;
const char *errorMessage = NULL;
BoolInt useShellExecute = True;
DWORD exitCode = 0;
@@ -306,7 +306,7 @@
BoolInt quoteMode = False;
for (;; cmdLineParams++)
{
- const wchar_t c = *cmdLineParams;
+ const WCHAR c = *cmdLineParams;
if (c == L'\"')
quoteMode = !quoteMode;
else if (c == 0 || (c == L' ' && !quoteMode))
@@ -335,14 +335,14 @@
wcscpy(path + pathLen, L"7z");
{
- wchar_t *s = path + wcslen(path);
+ WCHAR *s = path + wcslen(path);
UInt32 value = d;
unsigned k;
for (k = 0; k < 8; k++)
{
const unsigned t = value & 0xF;
value >>= 4;
- s[7 - k] = (wchar_t)((t < 10) ? ('0' + t) : ('A' + (t - 10)));
+ s[7 - k] = (WCHAR)((t < 10) ? ('0' + t) : ('A' + (t - 10)));
}
s[k] = '\0';
}
diff -Nru 7zip-22.01+really26.01+dfsg/C/XzDec.c
7zip-22.01+really26.02+dfsg/C/XzDec.c
--- 7zip-22.01+really26.01+dfsg/C/XzDec.c 2026-04-28 01:31:12.000000000
+0900
+++ 7zip-22.01+really26.02+dfsg/C/XzDec.c 2026-06-26 15:00:29.000000000
+0900
@@ -25,8 +25,8 @@
#define PRF(x)
#endif
-#define PRF_STR(s) PRF(printf("\n" s "\n"))
-#define PRF_STR_INT(s, d) PRF(printf("\n" s " %d\n", (unsigned)d))
+#define PRF_STR(s) PRF(printf("\n" s "\n");)
+#define PRF_STR_INT(s, d) PRF(printf("\n" s " %d\n", (unsigned)d);)
#include <stdlib.h>
#include <string.h>
@@ -574,7 +574,7 @@
output (status) can be :
CODER_STATUS_NOT_FINISHED
CODER_STATUS_FINISHED_WITH_MARK
- CODER_STATUS_NEEDS_MORE_INPUT - not implemented still
+ CODER_STATUS_NEEDS_MORE_INPUT
*/
static SRes MixCoder_Code(CMixCoder *p,
@@ -582,8 +582,8 @@
const Byte *src, SizeT *srcLen, int srcWasFinished,
ECoderFinishMode finishMode)
{
- SizeT destLenOrig = *destLen;
- SizeT srcLenOrig = *srcLen;
+ const SizeT destLenOrig = *destLen;
+ const SizeT srcLenOrig = *srcLen;
*destLen = 0;
*srcLen = 0;
@@ -597,39 +597,26 @@
if (p->outBuf)
{
SRes res;
- SizeT destLen2, srcLen2;
+ SizeT destLen2;
int wasFinished;
PRF_STR("------- MixCoder Single ----------")
- srcLen2 = srcLenOrig;
destLen2 = destLenOrig;
-
+ if (p->numCoders != 1)
{
- IStateCoder *coder = &p->coders[0];
- res = coder->Code2(coder->p, NULL, &destLen2, src, &srcLen2,
srcWasFinished, finishMode,
- // &wasFinished,
- &p->status);
- wasFinished = (p->status == CODER_STATUS_FINISHED_WITH_MARK);
+ if (destLen2 < p->outWritten)
+ return SZ_ERROR_FAIL;
+ destLen2 -= p->outWritten;
}
-
- p->res = res;
-
- /*
- if (wasFinished)
- p->status = CODER_STATUS_FINISHED_WITH_MARK;
- else
+ *srcLen = srcLenOrig;
{
- if (res == SZ_OK)
- if (destLen2 != destLenOrig)
- p->status = CODER_STATUS_NEEDS_MORE_INPUT;
+ IStateCoder *coder = &p->coders[0];
+ res = coder->Code2(coder->p, NULL, &destLen2, src, srcLen,
srcWasFinished, finishMode, &p->status);
}
- */
-
-
- *srcLen = srcLen2;
- src += srcLen2;
+ p->res = res;
p->outWritten += destLen2;
+ wasFinished = (p->status == CODER_STATUS_FINISHED_WITH_MARK);
if (res != SZ_OK || srcWasFinished || wasFinished)
p->wasFinished = True;
@@ -1016,8 +1003,8 @@
const Byte *src, SizeT *srcLen, int srcFinished,
ECoderFinishMode finishMode, ECoderStatus *status)
{
- SizeT destLenOrig = *destLen;
- SizeT srcLenOrig = *srcLen;
+ const SizeT destLenOrig = *destLen;
+ const SizeT srcLenOrig = *srcLen;
*destLen = 0;
*srcLen = 0;
*status = CODER_STATUS_NOT_SPECIFIED;
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/7z/7zIn.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/7z/7zIn.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/7z/7zIn.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/7z/7zIn.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -698,22 +698,24 @@
WaitId(NID::kSize);
f.PackPositions.Alloc(numPackStreams + 1);
+ UInt64 * const packPositions = f.PackPositions;
f.NumPackStreams = numPackStreams;
UInt64 sum = 0;
- for (CNum i = 0; i < numPackStreams; i++)
+ for (CNum i = 0;;)
{
- f.PackPositions[i] = sum;
+ packPositions[i] = sum;
+ if (i == numPackStreams)
+ break;
+ i++;
const UInt64 packSize = ReadNumber();
sum += packSize;
if (sum < packSize)
ThrowIncorrect();
}
- f.PackPositions[numPackStreams] = sum;
- UInt64 type;
for (;;)
{
- type = ReadID();
+ const UInt64 type = ReadID();
if (type == NID::kEnd)
return;
if (type == NID::kCRC)
@@ -857,19 +859,20 @@
StreamUsed[index] = true;
}
- for (i = 0; i < numCoders; i++)
+ for (i = 0;;)
+ {
if (!CoderUsed[i])
- {
- indexOfMainStream = i;
break;
- }
-
- if (i == numCoders)
- ThrowUnsupported();
+ if (++i == numCoders)
+ ThrowUnsupported();
+ }
+ indexOfMainStream = i;
}
folders.FoToCoderUnpackSizes[fo] = numCodersOutStreams;
numCodersOutStreams += numCoders;
+ if (numCodersOutStreams < numCoders)
+ ThrowUnsupported();
folders.FoStartPackStreamIndex[fo] = packStreamIndex;
if (numPackStreams > folders.NumPackStreams - packStreamIndex)
ThrowIncorrect();
@@ -880,7 +883,7 @@
const size_t dataSize = (size_t)(_inByteBack->GetPtr() - startBufPtr);
folders.FoToCoderUnpackSizes[fo] = numCodersOutStreams;
folders.FoStartPackStreamIndex[fo] = packStreamIndex;
- folders.FoCodersDataOffset[fo] = (size_t)(_inByteBack->GetPtr() -
startBufPtr);
+ folders.FoCodersDataOffset[fo] = dataSize;
folders.CodersData.CopyFrom(startBufPtr, dataSize);
// if (folders.NumPackStreams != packStreamIndex) ThrowUnsupported();
@@ -898,6 +901,8 @@
return;
if (type == NID::kCRC)
{
+ if (!folders.FolderCRCs.Defs.IsEmpty())
+ ThrowIncorrect();
ReadHashDigests(numFolders, folders.FolderCRCs);
continue;
}
@@ -911,19 +916,35 @@
CUInt32DefVector &digests)
{
folders.NumUnpackStreamsVector.Alloc(folders.NumFolders);
- CNum i;
- for (i = 0; i < folders.NumFolders; i++)
- folders.NumUnpackStreamsVector[i] = 1;
+ bool NumUnpackStream_isFilled = false;
UInt64 type;
+
+ CNum numUnpackStreams = folders.NumFolders;
for (;;)
{
type = ReadID();
if (type == NID::kNumUnpackStream)
{
- for (i = 0; i < folders.NumFolders; i++)
- folders.NumUnpackStreamsVector[i] = ReadNum();
+ if (NumUnpackStream_isFilled)
+ ThrowIncorrect();
+ NumUnpackStream_isFilled = true;
+ CNum numFolders = folders.NumFolders;
+ numUnpackStreams = 0;
+ if (numFolders)
+ {
+ UInt32 *dest = folders.NumUnpackStreamsVector.NonConstData();
+ do
+ {
+ const CNum num = ReadNum();
+ *dest++ = num;
+ numUnpackStreams += num;
+ if (numUnpackStreams < num)
+ ThrowUnsupported();
+ }
+ while (--numFolders);
+ }
continue;
}
if (type == NID::kCRC || type == NID::kSize || type == NID::kEnd)
@@ -931,6 +952,20 @@
SkipData();
}
+ if (!NumUnpackStream_isFilled)
+ {
+ CNum numFolders = folders.NumFolders;
+ if (numFolders)
+ {
+ UInt32 *dest = folders.NumUnpackStreamsVector.NonConstData();
+ do
+ *dest++ = 1;
+ while (--numFolders);
+ }
+ }
+
+ unpackSizes.ClearAndReserve(numUnpackStreams);
+ CNum i;
if (type == NID::kSize)
{
for (i = 0; i < folders.NumFolders; i++)
@@ -943,16 +978,20 @@
UInt64 sum = 0;
for (CNum j = 1; j < numSubstreams; j++)
{
+ if (unpackSizes.Size() >= numUnpackStreams)
+ ThrowIncorrect(); // internal failure
const UInt64 size = ReadNumber();
- unpackSizes.Add(size);
+ unpackSizes.AddInReserved(size);
sum += size;
if (sum < size)
ThrowIncorrect();
}
+ if (unpackSizes.Size() >= numUnpackStreams)
+ ThrowIncorrect(); // internal failure
const UInt64 folderUnpackSize = folders.GetFolderUnpackSize(i);
if (folderUnpackSize < sum)
ThrowIncorrect();
- unpackSizes.Add(folderUnpackSize - sum);
+ unpackSizes.AddInReserved(folderUnpackSize - sum);
}
type = ReadID();
}
@@ -966,10 +1005,17 @@
if (val > 1)
ThrowIncorrect();
if (val == 1)
- unpackSizes.Add(folders.GetFolderUnpackSize(i));
+ {
+ if (unpackSizes.Size() >= numUnpackStreams)
+ ThrowIncorrect(); // internal failure
+ unpackSizes.AddInReserved(folders.GetFolderUnpackSize(i));
+ }
}
}
+ if (unpackSizes.Size() != numUnpackStreams)
+ ThrowIncorrect();
+
unsigned numDigests = 0;
for (i = 0; i < folders.NumFolders; i++)
{
@@ -984,6 +1030,8 @@
break;
if (type == NID::kCRC)
{
+ if (!digests.Defs.IsEmpty())
+ ThrowIncorrect();
// CUInt32DefVector digests2;
// ReadHashDigests(numDigests, digests2);
CBoolVector digests2;
@@ -1092,10 +1140,13 @@
So we don't need to fill digests with values. */
// digests.Vals.ClearAndSetSize(folders.NumFolders);
// BoolVector_Fill_False(digests.Defs, folders.NumFolders);
+ unpackSizes.ClearAndSetSize(folders.NumFolders);
+ UInt64 * const unpackSizes2 = unpackSizes.NonConstData();
+ CNum * const numUnpackStreamsVector2 = folders.NumUnpackStreamsVector;
for (CNum i = 0; i < folders.NumFolders; i++)
{
- folders.NumUnpackStreamsVector[i] = 1;
- unpackSizes.Add(folders.GetFolderUnpackSize(i));
+ numUnpackStreamsVector2[i] = 1;
+ unpackSizes2[i] = folders.GetFolderUnpackSize(i);
// digests.Vals[i] = 0;
}
}
@@ -1648,8 +1699,8 @@
db.PhySize = kHeaderSize;
db.IsArc = false;
- if ((Int64)nextHeaderOffset < 0 ||
- nextHeaderSize > ((UInt64)1 << 62))
+ if (nextHeaderOffset >= (UInt64)1 << 62 ||
+ nextHeaderSize > ((UInt64)1 << 48))
return S_FALSE;
HeadersSize = kHeaderSize;
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/7z/7zUpdate.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/7z/7zUpdate.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/7z/7zUpdate.cpp
2026-04-28 01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/7z/7zUpdate.cpp
2026-06-26 15:00:29.000000000 +0900
@@ -36,13 +36,6 @@
UInt32 Offset; // for k_ARM64 / k_RISCV
// UInt32 AlignSizeOpt; // for k_ARM64
- CFilterMode():
- Id(0),
- Delta(0),
- Offset(0)
- // , AlignSizeOpt(0)
- {}
-
void ClearFilterMode()
{
Id = 0;
@@ -437,7 +430,11 @@
bool Encrypted;
unsigned GroupIndex;
- CFilterMode2(): Encrypted(false) {}
+ void Construct()
+ {
+ ClearFilterMode();
+ Encrypted = false;
+ }
int Compare(const CFilterMode2 &m) const
{
@@ -546,6 +543,7 @@
CRecordVector<CFilterMode2> &filters, const CFolderEx &f, bool
extractFilter)
{
CFilterMode2 m;
+ m.Construct();
// m.Id = 0;
// m.Delta = 0;
// m.Offset = 0;
@@ -795,14 +793,14 @@
unsigned NamePos;
unsigned ExtensionIndex;
- CRefItem() {}
- CRefItem(UInt32 index, const CUpdateItem &ui, bool sortByType):
- UpdateItem(&ui),
- Index(index),
- ExtensionPos(0),
- NamePos(0),
- ExtensionIndex(0)
+ void Construct(UInt32 index, const CUpdateItem &ui, bool sortByType)
{
+ UpdateItem = &ui;
+ Index = index;
+ ExtensionPos = 0;
+ NamePos = 0;
+ ExtensionIndex = 0;
+
if (sortByType)
{
const int slashPos = ui.Name.ReverseFind_PathSepar();
@@ -2154,6 +2152,7 @@
continue;
CFilterMode2 fm;
+ fm.Construct();
if (useFilters)
{
// analysis.ATime_Defined = false;
@@ -2710,7 +2709,7 @@
unsigned i;
for (i = 0; i < numFiles; i++)
- refItems[i] = CRefItem(group.Indices[i], updateItems[group.Indices[i]],
sortByType);
+ refItems[i].Construct(group.Indices[i], updateItems[group.Indices[i]],
sortByType);
CSortParam sortParam;
// sortParam.TreeFolders = &treeFolders;
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/ApfsHandler.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/ApfsHandler.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/ApfsHandler.cpp
2026-04-28 01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/ApfsHandler.cpp
2026-06-26 15:00:29.000000000 +0900
@@ -3487,7 +3487,7 @@
{ NULL, kpidChangeTime, VT_FILETIME },
{ "Added Time", kpidAddTime, VT_FILETIME },
{ NULL, kpidMethod, VT_BSTR },
- { NULL, kpidINode, VT_UI8 },
+ { NULL, kpidINode, VT_UI4 },
{ NULL, kpidLinks, VT_UI4 },
{ NULL, kpidSymLink, VT_BSTR },
{ NULL, kpidUserId, VT_UI4 },
@@ -3496,7 +3496,7 @@
#ifdef APFS_SHOW_ALT_STREAMS
{ NULL, kpidIsAltStream, VT_BOOL },
#endif
- { "Parent iNode", kpidParentINode, VT_UI8 },
+ { "Parent iNode", kpidParentINode, VT_UI4 },
{ "Primary Name", kpidPrimeName, VT_BSTR },
{ "Generation", kpidGeneration, VT_UI4 },
{ "Written Size", kpidBytesWritten, VT_UI8 },
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/ExtHandler.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/ExtHandler.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/ExtHandler.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/ExtHandler.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -628,6 +628,8 @@
UInt32 Gid; // fixed 21.02
// UInt16 Checksum;
+ UInt32 NumLinksCalced;
+
UInt64 FileSize;
CExtTime MTime;
CExtTime ATime;
@@ -639,17 +641,16 @@
UInt32 NumLinks;
UInt32 Flags;
- UInt32 NumLinksCalced;
-
Byte Block[kNodeBlockFieldSize];
- CNode():
- ParentNode(-1),
- ItemIndex(-1),
- SymLinkIndex(-1),
- DirIndex(-1),
- NumLinksCalced(0)
- {}
+ void Construct()
+ {
+ ParentNode = -1;
+ ItemIndex = -1;
+ SymLinkIndex = -1;
+ DirIndex = -1;
+ NumLinksCalced = 0;
+ }
bool IsFlags_HUGE() const { return (Flags & k_NodeFlags_HUGE) != 0; }
bool IsFlags_EXTENTS() const { return (Flags & k_NodeFlags_EXTENTS) != 0; }
@@ -1172,21 +1173,19 @@
{
// ---------- Read groups ----------
- CByteBuffer gdBuf;
const size_t gdBufSize = (size_t)numGroups << gdBits;
if ((gdBufSize >> gdBits) != numGroups)
return S_FALSE;
+ CByteBuffer gdBuf;
gdBuf.Alloc(gdBufSize);
RINOK(SeekAndRead(inStream, (_h.BlockBits <= 10 ? 2 : 1), gdBuf,
gdBufSize))
- for (unsigned i = 0; i < numGroups; i++)
+ const unsigned gd_Size = (unsigned)1 << gdBits;
+ const Byte *p = gdBuf;
+ for (unsigned i = 0; i < numGroups; i++, p += gd_Size)
{
CGroupDescriptor gd;
-
- const Byte *p = gdBuf + ((size_t)i << gdBits);
- const unsigned gd_Size = (unsigned)1 << gdBits;
gd.Parse(p, gd_Size);
-
if (_h.UseMetadataChecksum())
{
// use CRC32c
@@ -1228,7 +1227,10 @@
if (numNodes > (1 << 24))
return S_FALSE;
}
-
+
+ const size_t blockSize = (size_t)1 << _h.BlockBits;
+ if (numNodes > blockSize * 8)
+ return S_FALSE;
const UInt32 numReserveInodes = _h.NumInodes - _h.NumFreeInodes + 1;
// numReserveInodes = _h.NumInodes + 1;
if (numReserveInodes != 0)
@@ -1241,7 +1243,6 @@
nodesData.Alloc(nodesDataSize);
CByteBuffer nodesMap;
- const size_t blockSize = (size_t)1 << _h.BlockBits;
nodesMap.Alloc(blockSize);
unsigned globalNodeIndex = 0;
@@ -1282,6 +1283,7 @@
}
CNode node;
+ node.Construct();
PRF(printf("\nnode = %5d ", (unsigned)n));
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/HfsHandler.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/HfsHandler.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/HfsHandler.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/HfsHandler.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -437,7 +437,7 @@
int AttrIndex;
int Parent;
- CRef(): AttrIndex(kAttrIndex_Item), Parent(-1) {}
+ void Construct() { AttrIndex = kAttrIndex_Item; Parent = -1; }
bool IsResource() const { return AttrIndex == kAttrIndex_Resource; }
bool IsAltStream() const { return AttrIndex != kAttrIndex_Item; }
bool IsItem() const { return AttrIndex == kAttrIndex_Item; }
@@ -1259,6 +1259,7 @@
IdToIndexMap.Add(pair);
CRef ref;
+ ref.Construct();
ref.ItemIndex = i;
Refs.Add(ref);
@@ -1317,6 +1318,7 @@
ThereAreAltStreams = true;
CRef ref;
+ ref.Construct();
ref.AttrIndex = (int)i;
ref.Parent = refIndex;
ref.ItemIndex = Refs[refIndex].ItemIndex;
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/LpHandler.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/LpHandler.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/LpHandler.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/LpHandler.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -223,12 +223,13 @@
UInt64 GetSize() const { return NumSectors << kSectorSizeLog; }
UInt64 GetPackSize() const { return NumSectors_Pack << kSectorSizeLog; }
- CPartition():
- MethodsMask(0),
- NumSectors(0),
- NumSectors_Pack(0),
- Ext(NULL)
- {}
+ void Construct()
+ {
+ MethodsMask = 0;
+ NumSectors = 0;
+ NumSectors_Pack = 0;
+ Ext = NULL;
+ }
};
@@ -609,6 +610,7 @@
for (UInt32 i = 0; i < d.num_entries; i++)
{
CPartition part;
+ part.Construct();
part.Parse(buffer + d.offset + i * d.entry_size);
const UInt32 extLimit = part.first_extent_index + part.num_extents;
if (extLimit < part.first_extent_index ||
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/LvmHandler.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/LvmHandler.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/LvmHandler.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/LvmHandler.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -1050,8 +1050,6 @@
COM_TRY_BEGIN
NCOM::CPropVariant prop;
- const CItem &item = _items[index];
-
// const CLogVol &item = _items[index];
if (index >= _items.Size())
@@ -1070,6 +1068,7 @@
}
else
{
+ const CItem &item = _items[index];
switch (propID)
{
case kpidPath:
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/MbrHandler.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/MbrHandler.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/MbrHandler.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/MbrHandler.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -53,7 +53,12 @@
SectCyl = p[1];
Cyl8 = p[2];
}
- bool Check() const { return GetSector() > 0; }
+ bool Check() const
+ {
+ if ((Head | SectCyl | Cyl8) == 0)
+ return true;
+ return GetSector() > 0;
+ }
};
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/Nsis/NsisIn.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/Nsis/NsisIn.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/Nsis/NsisIn.cpp
2026-04-28 01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/Nsis/NsisIn.cpp
2026-06-26 15:00:29.000000000 +0900
@@ -190,7 +190,7 @@
{ 2 }, // "SetFileAttributes" },
{ 3 }, // CreateDirectory, SetOutPath
{ 3 }, // "IfFileExists" },
- { 3 }, // SetRebootFlag, ...
+ { 4 }, // SetRebootFlag, ...
{ 4 }, // "If" }, // IfAbort, IfSilent, IfErrors, IfRebootFlag
{ 2 }, // "Get" }, // GetInstDirError, GetErrorLevel
{ 4 }, // "Rename" },
@@ -3910,6 +3910,10 @@
if (params[2] != 0)
{
s += " lastused";
+ // (params[3] == (UInt32)(Int32)-1) is possible in NSIS 3.10.
+ // SetDetailsPrint lastused (special)
+ if ((Int32)params[3] < 0)
+ s += " ; (special)";
break;
}
UInt32 v;
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/NtfsHandler.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/NtfsHandler.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/NtfsHandler.cpp
2026-04-28 01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/NtfsHandler.cpp
2026-06-26 15:00:29.000000000 +0900
@@ -1433,7 +1433,12 @@
int ParentHost; /* index in Items array, if it's AltStream
-1: if it's not AltStream */
- CItem(): DataIndex(k_Item_DataIndex_IsDir), ParentFolder(-1), ParentHost(-1)
{}
+ void Construct()
+ {
+ DataIndex = k_Item_DataIndex_IsDir;
+ ParentFolder = -1;
+ ParentHost = -1;
+ }
bool IsAltStream() const { return ParentHost != -1; }
bool IsDir() const { return DataIndex == k_Item_DataIndex_IsDir; }
@@ -2060,6 +2065,7 @@
}
CItem item;
+ item.Construct();
item.NameIndex = t;
item.RecIndex = i;
item.DataIndex = rec.IsDir() ?
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/PeHandler.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/PeHandler.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/PeHandler.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/PeHandler.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -758,7 +758,13 @@
int StringIndex;
int VersionIndex;
- CMixItem(): SectionIndex(-1), ResourceIndex(-1), StringIndex(-1),
VersionIndex(-1) {}
+ void Construct()
+ {
+ SectionIndex = -1;
+ ResourceIndex = -1;
+ StringIndex = -1;
+ VersionIndex = -1;
+ }
bool IsSectionItem() const { return ResourceIndex < 0 && StringIndex < 0 &&
VersionIndex < 0; }
};
@@ -820,20 +826,22 @@
CObjectVector<CStringKeyValue> _versionKeys;
CByteBuffer _buf;
+
bool _oneLang;
- UString _resourcesPrefix;
- CUsedBitmap _usedRes;
// bool _parseResources;
bool _checksumError;
bool _sectionsError;
+ bool _coffMode;
+ bool _allowTail;
+
+ UString _resourcesPrefix;
+ CUsedBitmap _usedRes;
+
bool IsOpt() const { return _header.OptHeaderSize != 0; }
COptHeader _optHeader;
- bool _coffMode;
- bool _allowTail;
-
HRESULT LoadDebugSections(IInStream *stream, bool &thereIsSection);
HRESULT Open2(IInStream *stream, IArchiveOpenCallback *callback);
@@ -2269,6 +2277,7 @@
if (ParseVersion((const Byte *)_buf + offset, item.Size, f,
_versionKeys))
{
CMixItem mixItem;
+ mixItem.Construct();
mixItem.VersionIndex = (int)_versionFiles.Size();
mixItem.SectionIndex = (int)sectionIndex; // check it !!!!
CByteBuffer_WithLang &vf = _versionFiles.AddNew();
@@ -2300,6 +2309,7 @@
if (_strings[i].FinalSize() == 0)
continue;
CMixItem mixItem;
+ mixItem.Construct();
mixItem.StringIndex = (int)i;
mixItem.SectionIndex = (int)sectionIndex;
_mixItems.Add(mixItem);
@@ -2654,6 +2664,7 @@
if (item.Enabled)
{
CMixItem mixItem;
+ mixItem.Construct();
mixItem.SectionIndex = (int)i;
mixItem.ResourceIndex = (int)j;
if (item.IsRcDataOrUnknown())
@@ -2717,6 +2728,7 @@
}
CMixItem mixItem;
+ mixItem.Construct();
mixItem.SectionIndex = (int)i;
_mixItems.Add(mixItem);
}
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/SparseHandler.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/SparseHandler.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/SparseHandler.cpp
2026-04-28 01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/SparseHandler.cpp
2026-06-26 15:00:29.000000000 +0900
@@ -78,7 +78,7 @@
Byte Fill [kFillSize];
UInt64 PhyOffset;
- CChunk()
+ void Construct()
{
Fill[0] =
Fill[1] =
@@ -293,6 +293,7 @@
if (size < kChunkHeaderSize)
return S_FALSE;
CChunk c;
+ c.Construct();
c.PhyOffset = offset + kChunkHeaderSize;
c.VirtBlock = virtBlock;
offset += size;
@@ -364,6 +365,7 @@
{
CChunk c;
+ c.Construct();
c.VirtBlock = virtBlock;
c.PhyOffset = offset;
Chunks.AddInReserved(c);
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/SquashfsHandler.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/SquashfsHandler.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/SquashfsHandler.cpp
2026-04-28 01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/SquashfsHandler.cpp
2026-06-26 15:00:29.000000000 +0900
@@ -812,7 +812,7 @@
int Parent;
UInt32 Ptr;
- CItem(): Node(-1), Parent(-1), Ptr(0) {}
+ void Construct() { Node = -1; Parent = -1; Ptr = 0; }
};
struct CData
@@ -1497,7 +1497,7 @@
if (rem == 0)
return S_FALSE;
- UInt32 nameOffset = _h.GetFileNameOffset();
+ const UInt32 nameOffset = _h.GetFileNameOffset();
if (rem < nameOffset)
return S_FALSE;
@@ -1505,7 +1505,7 @@
return S_FALSE;
if (_openCallback)
{
- UInt64 numFiles = _items.Size();
+ const UInt64 numFiles = _items.Size();
if ((numFiles & 0xFFFF) == 0)
{
RINOK(_openCallback->SetCompleted(&numFiles, NULL))
@@ -1513,6 +1513,7 @@
}
CItem item;
+ item.Construct();
item.Ptr = (UInt32)(p - (const Byte *)_dirs.Data);
UInt32 size;
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/Wim/WimHandlerOut.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/Wim/WimHandlerOut.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/Wim/WimHandlerOut.cpp
2026-04-28 01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/Wim/WimHandlerOut.cpp
2026-06-26 15:00:29.000000000 +0900
@@ -177,7 +177,12 @@
int InArcIndex; // >= 0, if we use OLD Data
// -1, if we use NEW Data
- CUpdateItem(): MetaIndex(-1), AltStreamIndex(-1), InArcIndex(-1) {}
+ void Construct()
+ {
+ MetaIndex = -1;
+ AltStreamIndex = -1;
+ InArcIndex = -1;
+ }
};
@@ -894,6 +899,7 @@
for (i = 0; i < numItems; i++)
{
CUpdateItem ui;
+ ui.Construct();
UInt32 indexInArchive;
Int32 newData, newProps;
RINOK(callback->GetUpdateItemInfo(i, &newData, &newProps, &indexInArchive))
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/Wim/WimIn.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/Wim/WimIn.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/Wim/WimIn.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/Wim/WimIn.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -609,6 +609,7 @@
return S_FALSE;
CItem item;
+ item.Construct();
const UInt32 attrib = Get32(p + 8);
item.IsDir = ((attrib & 0x10) != 0);
{
@@ -729,6 +730,7 @@
{
ThereAreAltStreams = true;
CItem item2;
+ item2.Construct();
item2.Offset = pos;
item2.IsAltStream = true;
item2.Parent = (int)prevIndex;
@@ -1531,6 +1533,7 @@
if (!r.IsSolidBig() || Solids[r.SolidIndex].FirstSmallStream < 0)
{
CItem item;
+ item.Construct();
item.Offset = 0;
item.StreamIndex = (int)i;
item.ImageIndex = -1;
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/Wim/WimIn.h
7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/Wim/WimIn.h
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Archive/Wim/WimIn.h 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Archive/Wim/WimIn.h 2026-06-26
15:00:29.000000000 +0900
@@ -347,15 +347,16 @@
bool HasMetadata() const { return ImageIndex >= 0; }
- CItem():
- IndexInSorted(-1),
- StreamIndex(-1),
- Parent(-1),
- IsDir(false),
- IsAltStream(false),
- DirLevel(0),
- SubDirOffset(0)
- {}
+ void Construct()
+ {
+ IndexInSorted = -1;
+ StreamIndex = -1;
+ Parent = -1;
+ IsDir = false;
+ IsAltStream = false;
+ DirLevel = 0;
+ SubDirOffset = 0;
+ }
};
struct CImage
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Common/CreateCoder.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Common/CreateCoder.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Common/CreateCoder.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Common/CreateCoder.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -2,7 +2,7 @@
#include "StdAfx.h"
-#include "../../Windows/Defs.h"
+#include "../../Windows/WinDefs.h"
#include "../../Windows/PropVariant.h"
#include "CreateCoder.h"
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Common/MethodProps.h
7zip-22.01+really26.02+dfsg/CPP/7zip/Common/MethodProps.h
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Common/MethodProps.h 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Common/MethodProps.h 2026-06-26
15:00:29.000000000 +0900
@@ -6,8 +6,7 @@
#include "../../Common/MyString.h"
#include "../../Common/Defs.h"
-#include "../../Windows/Defs.h"
-
+#include "../../Windows/WinDefs.h"
#include "../../Windows/PropVariant.h"
#include "../ICoder.h"
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Common/PropId.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Common/PropId.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Common/PropId.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Common/PropId.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -3,10 +3,8 @@
#include "StdAfx.h"
#include "../../Common/MyWindows.h"
-
#include "../PropID.h"
-// VARTYPE
const Byte k7z_PROPID_To_VARTYPE[kpid_NUM_DEFINED] =
{
VT_EMPTY,
@@ -84,7 +82,7 @@
VT_UI4,
VT_BSTR,
VT_UI8,
- VT_UI8,
+ VT_UI4, // kpidNumAltStreams
VT_UI8,
VT_UI8,
VT_UI8,
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/Compress/CodecExports.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/Compress/CodecExports.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/Compress/CodecExports.cpp
2026-04-28 01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/Compress/CodecExports.cpp
2026-06-26 15:00:29.000000000 +0900
@@ -8,7 +8,7 @@
#include "../../Common/ComTry.h"
#include "../../Common/MyCom.h"
-#include "../../Windows/Defs.h"
+#include "../../Windows/WinDefs.h"
#include "../../Windows/PropVariant.h"
#include "../ICoder.h"
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Agent/AgentOut.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Agent/AgentOut.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Agent/AgentOut.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Agent/AgentOut.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -497,6 +497,7 @@
updatePairs.Add(up2);
}
CUpdatePair2 up2;
+ up2.Construct();
up2.NewData = up2.NewProps = true;
up2.UseArcProps = false;
up2.DirIndex = 0;
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Agent/AgentProxy.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Agent/AgentProxy.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Agent/AgentProxy.cpp
2026-04-28 01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Agent/AgentProxy.cpp
2026-06-26 15:00:29.000000000 +0900
@@ -233,11 +233,26 @@
}
}
+
+void CProxyArc::FreeFiles()
+{
+ const unsigned numFiles = NumFiles;
+ NumFiles = 0;
+ CProxyFile *f = Files;
+ for (unsigned i = 0; i < numFiles; i++, f++)
+ if (f->NeedDeleteName)
+ delete [](wchar_t *)(void *)f->Name;
+ delete []Files;
+ Files = NULL;
+}
+
+static const UInt32 k_NumFiles_Max = 0x7fffffff - 15;
+
HRESULT CProxyArc::Load(const CArc &arc, IProgress *progress)
{
// DWORD tickCount = GetTickCount(); for (int ttt = 0; ttt < 1; ttt++) {
- Files.Free();
+ FreeFiles();
Dirs.Clear();
Dirs.AddNew();
@@ -245,11 +260,15 @@
UInt32 numItems;
RINOK(archive->GetNumberOfItems(&numItems))
+ if (numItems > k_NumFiles_Max)
+ return E_OUTOFMEMORY;
if (progress)
RINOK(progress->SetTotal(numItems))
- Files.Alloc(numItems);
+ Z7_ARRAY_NEW(Files, CProxyFile, numItems)
+ memset(Files, 0, (size_t)numItems * sizeof(*Files));
+ NumFiles = numItems;
UString path;
UString name;
@@ -375,6 +394,7 @@
RINOK(Archive_IsItem_Dir(archive, i, isDir))
CProxyFile &f = Files[i];
+ f.Construct(); // optional because memset() in code above
f.NameLen = len - namePos;
s += namePos;
@@ -579,6 +599,19 @@
return false;
}
+
+void CProxyArc2::FreeFiles()
+{
+ const unsigned numFiles = NumFiles;
+ NumFiles = 0;
+ CProxyFile2 *f = Files;
+ for (unsigned i = 0; i < numFiles; i++, f++)
+ if (f->NeedDeleteName)
+ delete [](wchar_t *)(void *)f->Name;
+ delete []Files;
+ Files = NULL;
+}
+
HRESULT CProxyArc2::Load(const CArc &arc, IProgress *progress)
{
if (!arc.GetRawProps)
@@ -587,12 +620,14 @@
// DWORD tickCount = GetTickCount(); for (int ttt = 0; ttt < 1; ttt++) {
Dirs.Clear();
- Files.Free();
+ FreeFiles();
IInArchive *archive = arc.Archive;
UInt32 numItems;
RINOK(archive->GetNumberOfItems(&numItems))
+ if (numItems > k_NumFiles_Max)
+ return E_OUTOFMEMORY;
if (progress)
RINOK(progress->SetTotal(numItems))
UString fileName;
@@ -609,7 +644,9 @@
dir.PathPrefix = ':';
}
- Files.Alloc(numItems);
+ Z7_ARRAY_NEW(Files, CProxyFile2, numItems)
+ memset(Files, 0, (size_t)numItems * sizeof(*Files));
+ NumFiles = numItems;
UString tempUString;
AString tempAString;
@@ -619,11 +656,12 @@
{
if (progress && (i & 0xFFFFF) == 0)
{
- UInt64 currentItemIndex = i;
+ const UInt64 currentItemIndex = i;
RINOK(progress->SetCompleted(¤tItemIndex))
}
CProxyFile2 &file = Files[i];
+ file.Construct();
const void *p;
UInt32 size;
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Agent/AgentProxy.h
7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Agent/AgentProxy.h
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Agent/AgentProxy.h 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Agent/AgentProxy.h 2026-06-26
15:00:29.000000000 +0900
@@ -11,8 +11,12 @@
unsigned NameLen;
bool NeedDeleteName;
- CProxyFile(): Name(NULL), NameLen(0), NeedDeleteName(false) {}
- ~CProxyFile() { if (NeedDeleteName) delete [](wchar_t *)(void *)Name; } //
delete [](wchar_t *)Name;
+ void Construct()
+ {
+ Name = NULL;
+ NameLen = 0;
+ NeedDeleteName = false;
+ }
};
const unsigned k_Proxy_RootDirIndex = 0;
@@ -47,9 +51,14 @@
void CalculateSizes(unsigned dirIndex, IInArchive *archive);
unsigned AddDir(unsigned dirIndex, int arcIndex, const UString &name);
+ void FreeFiles();
public:
CObjectVector<CProxyDir> Dirs; // Dirs[0] - root
- CObjArray<CProxyFile> Files; // all items from archive in same order
+ CProxyFile *Files; // all items from archive in same order
+ unsigned NumFiles;
+
+ CProxyArc(): Files(NULL), NumFiles(0) {}
+ ~CProxyArc() { FreeFiles(); }
// returns index in Dirs[], or -1,
int FindSubDir(unsigned dirIndex, const wchar_t *name) const;
@@ -83,17 +92,17 @@
int GetDirIndex(bool forAltStreams) const { return forAltStreams ?
AltDirIndex : DirIndex; }
bool IsDir() const { return DirIndex != -1; }
- CProxyFile2():
- DirIndex(-1), AltDirIndex(-1), Parent(-1),
- Name(NULL), NameLen(0),
- NeedDeleteName(false),
- Ignore(false),
- IsAltStream(false)
- {}
- ~CProxyFile2()
+
+ void Construct()
{
- if (NeedDeleteName)
- delete [](wchar_t *)(void *)Name;
+ DirIndex = -1;
+ AltDirIndex = -1;
+ Parent = -1;
+ Name = NULL;
+ NameLen = 0;
+ NeedDeleteName = false;
+ Ignore = false;
+ IsAltStream = false;
}
};
@@ -110,8 +119,6 @@
UInt32 NumSubFiles;
CProxyDir2(): ArcIndex(-1) {}
- void AddFileSubItem(UInt32 index, const UString &name);
- void Clear();
};
const unsigned k_Proxy2_RootDirIndex = k_Proxy_RootDirIndex;
@@ -123,10 +130,15 @@
void CalculateSizes(unsigned dirIndex, IInArchive *archive);
// AddRealIndices_of_Dir DOES NOT ADD item itself represented by dirIndex
void AddRealIndices_of_Dir(unsigned dirIndex, bool includeAltStreams,
CUIntVector &realIndices) const;
+ void FreeFiles();
public:
CObjectVector<CProxyDir2> Dirs; // Dirs[0] - root folder
// Dirs[1] - for alt streams of root dir
- CObjArray<CProxyFile2> Files; // all items from archive in same order
+ CProxyFile2 *Files; // all items from archive in same order
+ unsigned NumFiles;
+
+ CProxyArc2(): Files(NULL), NumFiles(0) {}
+ ~CProxyArc2() { FreeFiles(); }
bool IsThere_SubDir(unsigned dirIndex, const UString &name) const;
diff -Nru
7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
2026-04-28 01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
2026-06-26 15:00:29.000000000 +0900
@@ -1842,6 +1842,11 @@
outStreamLoc = new CStdOutFileStream;
else
{
+ if (_isSplit)
+ {
+ RINOK(PrepareOperation(askExtractMode))
+ return
SetOperationResult(NArchive::NExtract::NOperationResult::kUnsupportedMethod);
+ }
bool needExit = true;
RINOK(GetExtractStream(outStreamLoc, needExit))
if (needExit)
@@ -2674,6 +2679,7 @@
{
COM_TRY_BEGIN
+ // if (_isSplit) opRes =
NArchive::NExtract::NOperationResult::kUnsupportedMethod;
// printf("\nCArchiveExtractCallback::SetOperationResult: %d %s\n", opRes,
GetAnsiString(_diskFilePath));
#ifndef Z7_SFX
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Common/LoadCodecs.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Common/LoadCodecs.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Common/LoadCodecs.cpp
2026-04-28 01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Common/LoadCodecs.cpp
2026-06-26 15:00:29.000000000 +0900
@@ -211,10 +211,11 @@
&& !NFind::DoesFileOrDirExist(moduleFolderPrefix + kFormatsFolderName))
{
FString path;
- if (ReadPathFromRegistry(HKEY_CURRENT_USER, kProgramPath2Value, path))
return path;
- if (ReadPathFromRegistry(HKEY_LOCAL_MACHINE, kProgramPath2Value, path))
return path;
- if (ReadPathFromRegistry(HKEY_CURRENT_USER, kProgramPathValue, path))
return path;
- if (ReadPathFromRegistry(HKEY_LOCAL_MACHINE, kProgramPathValue, path))
return path;
+ if ( ReadPathFromRegistry(HKEY_CURRENT_USER, kProgramPath2Value, path)
+ || ReadPathFromRegistry(HKEY_LOCAL_MACHINE, kProgramPath2Value, path)
+ || ReadPathFromRegistry(HKEY_CURRENT_USER, kProgramPathValue, path)
+ || ReadPathFromRegistry(HKEY_LOCAL_MACHINE, kProgramPathValue, path))
+ moduleFolderPrefix = path;
}
#endif
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Common/UpdatePair.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Common/UpdatePair.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Common/UpdatePair.cpp
2026-04-28 01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Common/UpdatePair.cpp
2026-06-26 15:00:29.000000000 +0900
@@ -196,6 +196,7 @@
while (dirIndex < numDirItems || arcIndex < numArcItems)
{
CUpdatePair pair;
+ pair.Construct();
int dirIndex2 = -1;
int arcIndex2 = -1;
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Common/UpdatePair.h
7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Common/UpdatePair.h
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Common/UpdatePair.h 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Common/UpdatePair.h 2026-06-26
15:00:29.000000000 +0900
@@ -15,7 +15,7 @@
int DirIndex;
int HostIndex; // >= 0 for alt streams only, contains index of host pair
- CUpdatePair(): ArcIndex(-1), DirIndex(-1), HostIndex(-1) {}
+ void Construct() { ArcIndex = -1; DirIndex = -1; HostIndex = -1; }
};
void GetUpdatePairInfoList(
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Common/UpdateProduce.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Common/UpdateProduce.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Common/UpdateProduce.cpp
2026-04-28 01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Common/UpdateProduce.cpp
2026-06-26 15:00:29.000000000 +0900
@@ -19,6 +19,7 @@
const CUpdatePair &pair = updatePairs[i];
CUpdatePair2 up2;
+ up2.Construct();
up2.DirIndex = pair.DirIndex;
up2.ArcIndex = pair.ArcIndex;
up2.NewData = up2.NewProps = true;
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Common/UpdateProduce.h
7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Common/UpdateProduce.h
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Common/UpdateProduce.h
2026-04-28 01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Common/UpdateProduce.h
2026-06-26 15:00:29.000000000 +0900
@@ -19,28 +19,28 @@
bool IsMainRenameItem;
bool IsSameTime;
+ void Construct()
+ {
+ NewData = false;
+ NewProps = false;
+ UseArcProps = false;
+ IsAnti = false;
+ DirIndex = -1;
+ ArcIndex = -1;
+ NewNameIndex = -1;
+ IsMainRenameItem = false;
+ IsSameTime = false;
+ }
+
void SetAs_NoChangeArcItem(unsigned arcIndex) // int
{
- NewData = NewProps = false;
+ Construct();
UseArcProps = true;
- IsAnti = false;
ArcIndex = (int)arcIndex;
}
bool ExistOnDisk() const { return DirIndex != -1; }
bool ExistInArchive() const { return ArcIndex != -1; }
-
- CUpdatePair2():
- NewData(false),
- NewProps(false),
- UseArcProps(false),
- IsAnti(false),
- DirIndex(-1),
- ArcIndex(-1),
- NewNameIndex(-1),
- IsMainRenameItem(false),
- IsSameTime(false)
- {}
};
Z7_PURE_INTERFACES_BEGIN
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Far/FarUtils.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Far/FarUtils.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Far/FarUtils.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Far/FarUtils.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -8,7 +8,7 @@
#ifndef UNDER_CE
#include "../../../Windows/Console.h"
#endif
-#include "../../../Windows/Defs.h"
+#include "../../../Windows/WinDefs.h"
#include "../../../Windows/ErrorMsg.h"
#include "FarUtils.h"
@@ -259,17 +259,15 @@
regKey.SetValue(valueName, value);
}
+/*
CSysString CStartupInfo::QueryRegKeyValue(HKEY parentKey, const char *keyName,
LPCTSTR valueName, const CSysString &valueDefault) const
{
- NRegistry::CKey regKey;
- if (OpenRegKey(parentKey, keyName, regKey) != ERROR_SUCCESS)
- return valueDefault;
-
CSysString value;
- if (regKey.QueryValue(valueName, value) != ERROR_SUCCESS)
- return valueDefault;
-
+ NRegistry::CKey regKey;
+ if (OpenRegKey(parentKey, keyName, regKey) != ERROR_SUCCESS
+ || regKey.QueryValue(valueName, value) != ERROR_SUCCESS)
+ value = valueDefault;
return value;
}
@@ -286,6 +284,7 @@
return value;
}
+*/
bool CStartupInfo::QueryRegKeyValue(HKEY parentKey, const char *keyName,
LPCTSTR valueName, bool valueDefault) const
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Far/Plugin.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Far/Plugin.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/Far/Plugin.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/UI/Far/Plugin.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -143,8 +143,13 @@
panelItem.Reserved[1] = 0;
}
+
+static const UInt32 k_NumFiles_Max = 0x7fffffff - 15;
+
int CPlugin::GetFindData(PluginPanelItem **panelItems, int *itemsNumber, int
opMode)
{
+ *panelItems = NULL;
+ *itemsNumber = 0;
// CScreenRestorer screenRestorer;
if ((opMode & OPM_SILENT) == 0 && (opMode & OPM_FIND ) == 0)
{
@@ -160,8 +165,13 @@
}
UInt32 numItems;
- _folder->GetNumberOfItems(&numItems);
- *panelItems = new PluginPanelItem[numItems];
+ if (_folder->GetNumberOfItems(&numItems) != S_OK)
+ return FALSE;
+ if (numItems > k_NumFiles_Max)
+ return FALSE;
+
+ Z7_ARRAY_NEW(*panelItems, PluginPanelItem, numItems)
+ memset(*panelItems, 0, (size_t)numItems * sizeof(PluginPanelItem));
try
{
for (UInt32 i = 0; i < numItems; i++)
@@ -174,6 +184,7 @@
catch(...)
{
delete [](*panelItems);
+ *panelItems = NULL;
throw;
}
*itemsNumber = (int)numItems;
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/FileManager/BrowseDialog2.cpp
7zip-22.01+really26.02+dfsg/CPP/7zip/UI/FileManager/BrowseDialog2.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/7zip/UI/FileManager/BrowseDialog2.cpp
2026-04-28 01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/7zip/UI/FileManager/BrowseDialog2.cpp
2026-06-26 15:00:29.000000000 +0900
@@ -95,15 +95,16 @@
UInt32 NumRootItems;
UInt64 Size;
- CBrowseItem():
- // MainFileIndex(0),
- SubFileIndex(-1),
- WasInterrupted(false),
- NumFiles(0),
- NumDirs(0),
- NumRootItems(0),
- Size(0)
- {}
+ void Construct()
+ {
+ // MainFileIndex = 0;
+ SubFileIndex = -1;
+ WasInterrupted = false;
+ NumFiles = 0;
+ NumDirs = 0;
+ NumRootItems = 0;
+ Size = 0;
+ }
};
@@ -114,6 +115,10 @@
CFileInfo fi_SubFile;
CBrowseItem bi;
+ CBrowseEnumerator()
+ {
+ bi.Construct();
+ }
void Enumerate(unsigned level);
bool NeedInterrupt() const
{
@@ -1504,6 +1509,7 @@
if (d.Len() < 2 || d.Back() != '\\')
return E_FAIL;
CBrowseItem item;
+ item.Construct();
item.MainFileIndex = files.Size();
CFileInfo &fi = files.AddNew();
fi.SetAsDir();
@@ -1552,6 +1558,7 @@
}
}
CBrowseItem item;
+ item.Construct();
item.MainFileIndex = files.Size();
item.Size = fi.Size;
files.Add(fi);
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Common/Common0.h
7zip-22.01+really26.02+dfsg/CPP/Common/Common0.h
--- 7zip-22.01+really26.01+dfsg/CPP/Common/Common0.h 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Common/Common0.h 2026-06-26
15:00:29.000000000 +0900
@@ -162,7 +162,7 @@
So we can use Z7_ARRAY_NEW macro instead of new[] operator. */
#if defined(_MSC_VER) && (_MSC_VER == 1200) && !defined(_WIN64)
- #define Z7_ARRAY_NEW(p, T, size) p = new T[((size) > 0xFFFFFFFFu /
sizeof(T)) ? 0xFFFFFFFFu / sizeof(T) : (size)];
+ #define Z7_ARRAY_NEW(p, T, size) p = new T[((size) > (0xFFFFFFFFu - 0x7fu)
/ sizeof(T)) ? (0xFFFFFFFFu - 0x7fu) / sizeof(T) : (size)];
#else
#define Z7_ARRAY_NEW(p, T, size) p = new T[size];
#endif
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/Clipboard.cpp
7zip-22.01+really26.02+dfsg/CPP/Windows/Clipboard.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/Clipboard.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/Clipboard.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -9,7 +9,7 @@
#include "../Common/StringConvert.h"
#include "Clipboard.h"
-#include "Defs.h"
+#include "WinDefs.h"
#include "MemoryGlobal.h"
#include "Shell.h"
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/CommonDialog.cpp
7zip-22.01+really26.02+dfsg/CPP/Windows/CommonDialog.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/CommonDialog.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/CommonDialog.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -13,7 +13,7 @@
#endif
#include "CommonDialog.h"
-#include "Defs.h"
+#include "WinDefs.h"
// #include "FileDir.h"
#ifndef _UNICODE
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/Console.h
7zip-22.01+really26.02+dfsg/CPP/Windows/Console.h
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/Console.h 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/Console.h 2026-06-26
15:00:29.000000000 +0900
@@ -3,7 +3,7 @@
#ifndef ZIP7_INC_WINDOWS_CONSOLE_H
#define ZIP7_INC_WINDOWS_CONSOLE_H
-#include "Defs.h"
+#include "WinDefs.h"
namespace NWindows {
namespace NConsole {
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/Control/ImageList.h
7zip-22.01+really26.02+dfsg/CPP/Windows/Control/ImageList.h
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/Control/ImageList.h 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/Control/ImageList.h 2026-06-26
15:00:29.000000000 +0900
@@ -5,7 +5,7 @@
#include <CommCtrl.h>
-#include "../Defs.h"
+#include "../WinDefs.h"
namespace NWindows {
namespace NControl {
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/Defs.h
7zip-22.01+really26.02+dfsg/CPP/Windows/Defs.h
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/Defs.h 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/Defs.h 1970-01-01
09:00:00.000000000 +0900
@@ -1,17 +0,0 @@
-// Windows/Defs.h
-
-#ifndef ZIP7_INC_WINDOWS_DEFS_H
-#define ZIP7_INC_WINDOWS_DEFS_H
-
-#include "../Common/MyWindows.h"
-
-#ifdef _WIN32
-inline BOOL BoolToBOOL(bool v) { return (v ? TRUE: FALSE); }
-#endif
-
-inline bool BOOLToBool(BOOL v) { return (v != FALSE); }
-
-inline VARIANT_BOOL BoolToVARIANT_BOOL(bool v) { return (v ? VARIANT_TRUE:
VARIANT_FALSE); }
-inline bool VARIANT_BOOLToBool(VARIANT_BOOL v) { return (v != VARIANT_FALSE); }
-
-#endif
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/FileFind.h
7zip-22.01+really26.02+dfsg/CPP/Windows/FileFind.h
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/FileFind.h 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/FileFind.h 2026-06-26
15:00:29.000000000 +0900
@@ -13,8 +13,6 @@
#include "../Common/MyString.h"
#include "../Common/MyWindows.h"
-#include "Defs.h"
-
#include "FileIO.h"
namespace NWindows {
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/FileIO.h
7zip-22.01+really26.02+dfsg/CPP/Windows/FileIO.h
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/FileIO.h 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/FileIO.h 2026-06-26
15:00:29.000000000 +0900
@@ -31,7 +31,7 @@
#include "../Windows/TimeUtils.h"
-#include "Defs.h"
+#include "WinDefs.h"
HRESULT GetLastError_noZero_HRESULT();
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/FileSystem.cpp
7zip-22.01+really26.02+dfsg/CPP/Windows/FileSystem.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/FileSystem.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/FileSystem.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -9,7 +9,7 @@
#endif
#include "FileSystem.h"
-#include "Defs.h"
+#include "WinDefs.h"
#ifndef _UNICODE
extern bool g_IsNT;
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/Menu.h
7zip-22.01+really26.02+dfsg/CPP/Windows/Menu.h
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/Menu.h 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/Menu.h 2026-06-26
15:00:29.000000000 +0900
@@ -6,7 +6,7 @@
#include "../Common/MyWindows.h"
#include "../Common/MyString.h"
-#include "Defs.h"
+#include "WinDefs.h"
namespace NWindows {
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/ProcessUtils.h
7zip-22.01+really26.02+dfsg/CPP/Windows/ProcessUtils.h
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/ProcessUtils.h 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/ProcessUtils.h 2026-06-26
15:00:29.000000000 +0900
@@ -39,7 +39,7 @@
#include "../Common/MyString.h"
-#include "Defs.h"
+#include "WinDefs.h"
#include "Handle.h"
namespace NWindows {
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/PropVariantConv.cpp
7zip-22.01+really26.02+dfsg/CPP/Windows/PropVariantConv.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/PropVariantConv.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/PropVariantConv.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -4,7 +4,7 @@
#include "../Common/IntToString.h"
-#include "Defs.h"
+#include "WinDefs.h"
#include "PropVariantConv.h"
#define UINT_TO_STR_2(c, val) { s[0] = (c); s[1] = (char)('0' + (val) / 10);
s[2] = (char)('0' + (val) % 10); s += 3; }
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/SecurityUtils.h
7zip-22.01+really26.02+dfsg/CPP/Windows/SecurityUtils.h
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/SecurityUtils.h 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/SecurityUtils.h 2026-06-26
15:00:29.000000000 +0900
@@ -9,7 +9,7 @@
#include <NTSecAPI.h>
#endif
-#include "Defs.h"
+#include "WinDefs.h"
#ifndef _UNICODE
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/Shell.h
7zip-22.01+really26.02+dfsg/CPP/Windows/Shell.h
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/Shell.h 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/Shell.h 2026-06-26
15:00:29.000000000 +0900
@@ -12,7 +12,7 @@
#include "../Common/MyString.h"
-#include "Defs.h"
+#include "WinDefs.h"
namespace NWindows {
namespace NShell {
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/Synchronization.h
7zip-22.01+really26.02+dfsg/CPP/Windows/Synchronization.h
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/Synchronization.h 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/Synchronization.h 2026-06-26
15:00:29.000000000 +0900
@@ -7,7 +7,7 @@
#include "../Common/MyTypes.h"
-#include "Defs.h"
+#include "WinDefs.h"
#ifdef _WIN32
#include "Handle.h"
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/Thread.h
7zip-22.01+really26.02+dfsg/CPP/Windows/Thread.h
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/Thread.h 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/Thread.h 2026-06-26
15:00:29.000000000 +0900
@@ -5,7 +5,7 @@
#include "../../C/Threads.h"
-#include "Defs.h"
+#include "WinDefs.h"
namespace NWindows {
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/TimeUtils.cpp
7zip-22.01+really26.02+dfsg/CPP/Windows/TimeUtils.cpp
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/TimeUtils.cpp 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/TimeUtils.cpp 2026-06-26
15:00:29.000000000 +0900
@@ -7,8 +7,8 @@
#include <time.h>
#endif
-#include "Defs.h"
#include "TimeUtils.h"
+#include "WinDefs.h"
namespace NWindows {
namespace NTime {
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/WinDefs.h
7zip-22.01+really26.02+dfsg/CPP/Windows/WinDefs.h
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/WinDefs.h 1970-01-01
09:00:00.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/WinDefs.h 2026-06-26
15:00:29.000000000 +0900
@@ -0,0 +1,17 @@
+// Windows/Defs.h
+
+#ifndef ZIP7_INC_WINDOWS_WIN_DEFS_H
+#define ZIP7_INC_WINDOWS_WIN_DEFS_H
+
+#include "../Common/MyWindows.h"
+
+#ifdef _WIN32
+inline BOOL BoolToBOOL(bool v) { return (v ? TRUE: FALSE); }
+#endif
+
+inline bool BOOLToBool(BOOL v) { return (v != FALSE); }
+
+inline VARIANT_BOOL BoolToVARIANT_BOOL(bool v) { return (v ? VARIANT_TRUE:
VARIANT_FALSE); }
+inline bool VARIANT_BOOLToBool(VARIANT_BOOL v) { return (v != VARIANT_FALSE); }
+
+#endif
diff -Nru 7zip-22.01+really26.01+dfsg/CPP/Windows/Window.h
7zip-22.01+really26.02+dfsg/CPP/Windows/Window.h
--- 7zip-22.01+really26.01+dfsg/CPP/Windows/Window.h 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/CPP/Windows/Window.h 2026-06-26
15:00:29.000000000 +0900
@@ -6,7 +6,7 @@
#include "../Common/MyWindows.h"
#include "../Common/MyString.h"
-#include "Defs.h"
+#include "WinDefs.h"
#ifndef UNDER_CE
#ifdef WM_CHANGEUISTATE
diff -Nru 7zip-22.01+really26.01+dfsg/DOC/7zip.wxs
7zip-22.01+really26.02+dfsg/DOC/7zip.wxs
--- 7zip-22.01+really26.01+dfsg/DOC/7zip.wxs 2026-04-28 01:31:12.000000000
+0900
+++ 7zip-22.01+really26.02+dfsg/DOC/7zip.wxs 2026-06-26 15:00:29.000000000
+0900
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<?define VerMajor = "26" ?>
-<?define VerMinor = "01" ?>
+<?define VerMinor = "02" ?>
<?define VerBuild = "00" ?>
<?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?>
<?define MmHex = "$(var.VerMajor)$(var.VerMinor)" ?>
diff -Nru 7zip-22.01+really26.01+dfsg/DOC/readme.txt
7zip-22.01+really26.02+dfsg/DOC/readme.txt
--- 7zip-22.01+really26.01+dfsg/DOC/readme.txt 2026-04-28 01:31:12.000000000
+0900
+++ 7zip-22.01+really26.02+dfsg/DOC/readme.txt 2026-06-26 15:00:29.000000000
+0900
@@ -1,4 +1,4 @@
-7-Zip 26.01 Sources
+7-Zip 26.02 Sources
-------------------
7-Zip is a file archiver for Windows.
diff -Nru 7zip-22.01+really26.01+dfsg/DOC/src-history.txt
7zip-22.01+really26.02+dfsg/DOC/src-history.txt
--- 7zip-22.01+really26.01+dfsg/DOC/src-history.txt 2026-04-28
01:31:12.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/DOC/src-history.txt 2026-06-26
15:00:29.000000000 +0900
@@ -1,6 +1,11 @@
HISTORY of the 7-Zip source code
--------------------------------
+26.02 2026-06-25
+-------------------------
+- Some bugs and vulnerabilities were fixed.
+
+
26.01 2026-04-27
-------------------------
- linux version of 7-Zip can use huge pages (2 MB pages). It can increase
compression
diff -Nru 7zip-22.01+really26.01+dfsg/debian/changelog
7zip-22.01+really26.02+dfsg/debian/changelog
--- 7zip-22.01+really26.01+dfsg/debian/changelog 2026-06-04
19:50:45.000000000 +0900
+++ 7zip-22.01+really26.02+dfsg/debian/changelog 2026-07-02
09:17:47.000000000 +0900
@@ -1,3 +1,9 @@
+7zip (22.01+really26.02+dfsg-0+deb12u1) bookworm; urgency=high
+
+ * New upstream version 26.02+dfsg
+
+ -- YOKOTA Hiroshi <[email protected]> Thu, 02 Jul 2026 09:17:47 +0900
+
7zip (22.01+really26.01+dfsg-0+deb12u1) bookworm; urgency=high
* 7zip 26.01 includes these fixes: