3rdparty: Update LZMA/7zipSDK to 26.03

This commit is contained in:
JordanTheToaster
2026-09-19 13:52:30 -04:00
committed by Ty
parent 951515a4b5
commit f4e078a1a9
11 changed files with 123 additions and 70 deletions
+1
View File
@@ -556,6 +556,7 @@ struct ISzAlloc
#define Z7_memset_0_ARRAY(a) memset((a), 0, sizeof(a)) #define Z7_memset_0_ARRAY(a) memset((a), 0, sizeof(a))
#define Z7_memset_0_VAR(a) memset(&(a), 0, sizeof(a))
#ifndef Z7_ARRAY_SIZE #ifndef Z7_ARRAY_SIZE
#define Z7_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) #define Z7_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+3 -3
View File
@@ -1,7 +1,7 @@
#define MY_VER_MAJOR 26 #define MY_VER_MAJOR 26
#define MY_VER_MINOR 2 #define MY_VER_MINOR 3
#define MY_VER_BUILD 0 #define MY_VER_BUILD 0
#define MY_VERSION_NUMBERS "26.02" #define MY_VERSION_NUMBERS "26.03"
#define MY_VERSION MY_VERSION_NUMBERS #define MY_VERSION MY_VERSION_NUMBERS
#ifdef MY_CPU_NAME #ifdef MY_CPU_NAME
@@ -10,7 +10,7 @@
#define MY_VERSION_CPU MY_VERSION #define MY_VERSION_CPU MY_VERSION
#endif #endif
#define MY_DATE "2026-06-25" #define MY_DATE "2026-09-03"
#undef MY_COPYRIGHT #undef MY_COPYRIGHT
#undef MY_VERSION_COPYRIGHT_DATE #undef MY_VERSION_COPYRIGHT_DATE
#define MY_AUTHOR_NAME "Igor Pavlov" #define MY_AUTHOR_NAME "Igor Pavlov"
+30
View File
@@ -125,6 +125,36 @@ typedef void (*Z7_void_Function)(void);
#pragma warning(disable : 4464) // relative include path contains '..' #pragma warning(disable : 4464) // relative include path contains '..'
#endif #endif
// #define Z7_ANALYZE_MODE
#if defined(Z7_ANALYZE_MODE) // && defined(Z7_MSC_VER_ORIGINAL)
// for -analyze switch:
#if _MSC_VER >= 1900
#pragma warning(disable : 6001) // Using uninitialized memory 'ps'.
#pragma warning(disable : 6031) // Return value ignored: 'CoInitialize'
#pragma warning(disable : 6553) // The annotation for function 'RegOpenKeyExW' on _Param_(3) does not apply to a value type.
#pragma warning(disable : 28159) // Random.cpp(21) : Consider using 'GetTickCount64' instead of 'GetTickCount'
#pragma warning(disable : 28160) // ProcessUtils.h(92) : Error annotation: Passing MEM_RELEASE and a non-zero dwSize parameter to VirtualFree is not allowed. This results in the failure of this call
#pragma warning(disable : 28251) // Inconsistent annotation for 'WinMain': this instance has no annotations. See c:\program files (x86)\windows kits\10\include\10.0.26100.0\um\winbase.h(1062).
#pragma warning(disable : 28286) // um\consoleapi.h(236) : For function 'ReadConsoleW', error near the end of 'SAL_readableTo(byteCount(*__formal(3,lpNumberOfCharsRead) * sizeof(TCHAR%)))'.
#pragma warning(disable : 28301) // No annotations for first declaration of 'PNTSTATUS'. See c:\program files (x86)\windows kits\10\include\10.0.26100.0\shared\bcrypt.h(40).
#endif
#if _MSC_VER >= 1600
#pragma warning(disable : 6011) // Dereferencing NULL pointer 'p->IsDirs'
#pragma warning(disable : 6255) // `_alloca` indicates failure by raising a stack overflow exception. Consider using _malloca instead.
#pragma warning(disable : 6258) // Using TerminateThread does not allow proper thread clean up.
// #pragma warning(disable : 6262) // SfxSetup.c : Function uses '32808' bytes of stack.
#pragma warning(disable : 6320) // Threads.c : Exception-filter expression is the constant EXCEPTION_EXECUTE_HANDLER. This might mask exceptions that were not intended to be handled.
#pragma warning(disable : 6385) // createcoder.cpp : Invalid data: accessing 'struct CCodecInfo const * * g_Codecs', the readable size is '256' bytes, but '4194244' bytes might be read: Lines: 338, 339, 340, 342, 344
#pragma warning(disable : 6387) // MyString.cpp : 's' could be '0': this does not adhere to the specification for the function 'wmemcpy'
#endif
#if _MSC_VER == 1600
#pragma warning(disable : 6200) // compressdialog.cpp : Index '31' is out of valid index range '0' to '9' for non-stack buffer 'g_Levels'
#pragma warning(disable : 6204) // Possible buffer overrun in call to 'memset': use of unchecked parameter 'size'
#pragma warning(disable : 6309) // Argument '1' is null: this does not adhere to function specification of 'GetProcAddress'
#pragma warning(disable : 6386) // myvector.h : Buffer overrun: accessing 'argument 1', the writable size is 'newCapacity*4' bytes, but '8' bytes might be written
#endif
#endif // Z7_ANALYZE_MODE
// == 1200 : -O1 : for __forceinline // == 1200 : -O1 : for __forceinline
// >= 1900 : -O1 : for printf // >= 1900 : -O1 : for printf
#pragma warning(disable : 4710) // function not inlined #pragma warning(disable : 4710) // function not inlined
+11
View File
@@ -209,6 +209,17 @@ MY_CPU_64BIT means that processor can work with 64-bit registers.
#endif #endif
#if defined(__s390__)
#if defined(__s390x__) || defined(__LP64__) || (defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 8)
#define MY_CPU_NAME "s390x"
#define MY_CPU_SIZEOF_POINTER 8
#else
#define MY_CPU_NAME "s390"
#define MY_CPU_SIZEOF_POINTER 4
#endif
#endif
// #undef MY_CPU_NAME // #undef MY_CPU_NAME
// #undef MY_CPU_SIZEOF_POINTER // #undef MY_CPU_SIZEOF_POINTER
// #define __e2k__ // #define __e2k__
+5
View File
@@ -1,6 +1,11 @@
ISTORY of the LZMA SDK ISTORY of the LZMA SDK
----------------------- -----------------------
26.03 2026-09-03
-------------------------
- Some bugs and vulnerabilities were fixed.
26.02 2026-06-25 26.02 2026-06-25
------------------------- -------------------------
- Some bugs and vulnerabilities were fixed. - Some bugs and vulnerabilities were fixed.
+36 -37
View File
@@ -99,62 +99,61 @@ static Byte ReadByte(IByteInPtr pp)
static SRes SzDecodePpmd(const Byte *props, unsigned propsSize, UInt64 inSize, ILookInStreamPtr inStream, static SRes SzDecodePpmd(const Byte *props, unsigned propsSize, UInt64 inSize, ILookInStreamPtr inStream,
Byte *outBuffer, SizeT outSize, ISzAllocPtr allocMain) Byte *outBuffer, SizeT outSize, ISzAllocPtr allocMain)
{ {
CPpmd7 ppmd; CPpmd7 *ppmd;
CByteInToLook s; SRes res;
SRes res = SZ_OK; unsigned order;
UInt32 memSize;
s.vt.Read = ReadByte;
s.inStream = inStream;
s.begin = s.end = s.cur = NULL;
s.extra = False;
s.res = SZ_OK;
s.processed = 0;
if (propsSize != 5) if (propsSize != 5)
return SZ_ERROR_UNSUPPORTED; return SZ_ERROR_UNSUPPORTED;
order = props[0];
memSize = GetUi32(props + 1);
if (order < PPMD7_MIN_ORDER ||
order > PPMD7_MAX_ORDER ||
memSize < PPMD7_MIN_MEM_SIZE ||
memSize > PPMD7_MAX_MEM_SIZE)
return SZ_ERROR_UNSUPPORTED;
if ((ppmd = (CPpmd7 *)ISzAlloc_Alloc(allocMain, sizeof(CPpmd7))) == NULL)
return SZ_ERROR_MEM;
Ppmd7_Construct(ppmd);
res = SZ_ERROR_MEM;
if (Ppmd7_Alloc(ppmd, memSize, allocMain))
{
CByteInToLook s;
s.vt.Read = ReadByte;
s.inStream = inStream;
s.begin = s.end = s.cur = NULL;
s.extra = False;
s.res = SZ_OK;
s.processed = 0;
{ Ppmd7_Init(ppmd, order);
unsigned order = props[0]; ppmd->rc.dec.Stream = &s.vt;
UInt32 memSize = GetUi32(props + 1); res = SZ_ERROR_DATA;
if (order < PPMD7_MIN_ORDER || if (Ppmd7z_RangeDec_Init(&ppmd->rc.dec) && !s.extra)
order > PPMD7_MAX_ORDER ||
memSize < PPMD7_MIN_MEM_SIZE ||
memSize > PPMD7_MAX_MEM_SIZE)
return SZ_ERROR_UNSUPPORTED;
Ppmd7_Construct(&ppmd);
if (!Ppmd7_Alloc(&ppmd, memSize, allocMain))
return SZ_ERROR_MEM;
Ppmd7_Init(&ppmd, order);
}
{
ppmd.rc.dec.Stream = &s.vt;
if (!Ppmd7z_RangeDec_Init(&ppmd.rc.dec))
res = SZ_ERROR_DATA;
else if (!s.extra)
{ {
Byte *buf = outBuffer; Byte *buf = outBuffer;
const Byte *lim = buf + outSize; const Byte *lim = buf + outSize;
for (; buf != lim; buf++) for (; buf != lim; buf++)
{ {
int sym = Ppmd7z_DecodeSymbol(&ppmd); int sym = Ppmd7z_DecodeSymbol(ppmd);
if (s.extra || sym < 0) if (s.extra || sym < 0)
break; break;
*buf = (Byte)sym; *buf = (Byte)sym;
} }
if (buf != lim) if (buf == lim)
res = SZ_ERROR_DATA; if (Ppmd7z_RangeDec_IsFinishedOK(&ppmd->rc.dec)
else if (!Ppmd7z_RangeDec_IsFinishedOK(&ppmd.rc.dec)) // || (Ppmd7z_DecodeSymbol(&ppmd) == PPMD7_SYM_END && Ppmd7z_RangeDec_IsFinishedOK(&ppmd.rc.dec))
{ )
/* if (Ppmd7z_DecodeSymbol(&ppmd) != PPMD7_SYM_END || !Ppmd7z_RangeDec_IsFinishedOK(&ppmd.rc.dec)) */ res = SZ_OK;
res = SZ_ERROR_DATA;
}
} }
if (s.extra) if (s.extra)
res = (s.res != SZ_OK ? s.res : SZ_ERROR_DATA); res = (s.res != SZ_OK ? s.res : SZ_ERROR_DATA);
else if (s.processed + (size_t)(s.cur - s.begin) != inSize) else if (s.processed + (size_t)(s.cur - s.begin) != inSize)
res = SZ_ERROR_DATA; res = SZ_ERROR_DATA;
Ppmd7_Free(ppmd, allocMain);
} }
Ppmd7_Free(&ppmd, allocMain); ISzAlloc_Free(allocMain, ppmd);
return res; return res;
} }
+5 -2
View File
@@ -1,5 +1,5 @@
/* Bcj2Enc.c -- BCJ2 Encoder converter for x86 code (Branch CALL/JUMP variant2) /* Bcj2Enc.c -- BCJ2 Encoder converter for x86 code (Branch CALL/JUMP variant2)
2023-04-02 : Igor Pavlov : Public domain */ : Igor Pavlov : Public domain */
#include "Precomp.h" #include "Precomp.h"
@@ -75,7 +75,10 @@ static BoolInt Bcj2_RangeEnc_ShiftLow(CBcj2Enc *p)
p->cache = (Byte)(low >> 24); p->cache = (Byte)(low >> 24);
} }
p->cacheSize++; p->cacheSize++;
p->low = low << 8; {
const UInt32 low2 = low << 8;
p->low = low2;
}
return False; return False;
} }
+7 -15
View File
@@ -129,11 +129,10 @@ UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle p);
static SRes Lzma2EncInt_EncodeSubblock(CLzma2EncInt *p, Byte *outBuf, static SRes Lzma2EncInt_EncodeSubblock(CLzma2EncInt *p, Byte *outBuf,
size_t *packSizeRes, ISeqOutStreamPtr outStream) size_t *packSizeRes, ISeqOutStreamPtr outStream)
{ {
size_t packSizeLimit = *packSizeRes; const size_t packSizeLimit = *packSizeRes;
size_t packSize = packSizeLimit; size_t packSize = packSizeLimit;
UInt32 unpackSize = LZMA2_UNPACK_SIZE_MAX; UInt32 unpackSize = LZMA2_UNPACK_SIZE_MAX;
unsigned lzHeaderSize = 5 + (p->needInitProp ? 1 : 0); const unsigned lzHeaderSize = 5 + (p->needInitProp ? 1 : 0);
BoolInt useCopyBlock;
SRes res; SRes res;
*packSizeRes = 0; *packSizeRes = 0;
@@ -150,22 +149,13 @@ static SRes Lzma2EncInt_EncodeSubblock(CLzma2EncInt *p, Byte *outBuf,
if (unpackSize == 0) if (unpackSize == 0)
return res; return res;
if (res == SZ_OK) if (res == SZ_ERROR_OUTPUT_EOF
useCopyBlock = (packSize + 2 >= unpackSize || packSize > (1 << 16)); || (res == SZ_OK && (packSize + 2 >= unpackSize || packSize > (1 << 16))))
else
{
if (res != SZ_ERROR_OUTPUT_EOF)
return res;
res = SZ_OK;
useCopyBlock = True;
}
if (useCopyBlock)
{ {
size_t destPos = 0; size_t destPos = 0;
PRF(printf("################# COPY ")); PRF(printf("################# COPY "));
while (unpackSize > 0) while (unpackSize)
{ {
const UInt32 u = (unpackSize < LZMA2_COPY_CHUNK_SIZE) ? unpackSize : LZMA2_COPY_CHUNK_SIZE; const UInt32 u = (unpackSize < LZMA2_COPY_CHUNK_SIZE) ? unpackSize : LZMA2_COPY_CHUNK_SIZE;
if (packSizeLimit - destPos < u + 3) if (packSizeLimit - destPos < u + 3)
@@ -194,6 +184,8 @@ static SRes Lzma2EncInt_EncodeSubblock(CLzma2EncInt *p, Byte *outBuf,
return SZ_OK; return SZ_OK;
} }
if (res != SZ_OK)
return res;
{ {
size_t destPos = 0; size_t destPos = 0;
const UInt32 u = unpackSize - 1; const UInt32 u = unpackSize - 1;
+11 -7
View File
@@ -1,5 +1,5 @@
/* LzmaDec.c -- LZMA Decoder /* LzmaDec.c -- LZMA Decoder
2023-04-07 : Igor Pavlov : Public domain */ : Igor Pavlov : Public domain */
#include "Precomp.h" #include "Precomp.h"
@@ -462,8 +462,10 @@ int Z7_FASTCALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
if (state >= kNumStates) if (state >= kNumStates)
{ {
UInt32 distance; UInt32 distance;
prob = probs + PosSlot + {
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits); const unsigned temp = (len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits;
prob = probs + PosSlot + temp;
}
TREE_6_DECODE(prob, distance) TREE_6_DECODE(prob, distance)
if (distance >= kStartPosModelIndex) if (distance >= kStartPosModelIndex)
{ {
@@ -857,9 +859,10 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, const Byt
if (state < 4) if (state < 4)
{ {
unsigned posSlot; unsigned posSlot;
prob = probs + PosSlot + {
((len < kNumLenToPosStates - 1 ? len : kNumLenToPosStates - 1) << const unsigned temp = (len < kNumLenToPosStates - 1 ? len : kNumLenToPosStates - 1) << kNumPosSlotBits;
kNumPosSlotBits); prob = probs + PosSlot + temp;
}
TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot) TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot)
if (posSlot >= kStartPosModelIndex) if (posSlot >= kStartPosModelIndex)
{ {
@@ -867,7 +870,8 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, const Byt
if (posSlot < kEndPosModelIndex) if (posSlot < kEndPosModelIndex)
{ {
prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits); const unsigned temp = (2 | (posSlot & 1)) << numDirectBits;
prob = probs + SpecPos + temp;
} }
else else
{ {
+9 -4
View File
@@ -692,7 +692,10 @@ Z7_NO_INLINE static void Z7_FASTCALL RangeEnc_ShiftLow(CRangeEnc *p)
{ {
UInt32 low = (UInt32)p->low; UInt32 low = (UInt32)p->low;
unsigned high = (unsigned)(p->low >> 32); unsigned high = (unsigned)(p->low >> 32);
p->low = (UInt32)(low << 8); {
const UInt32 low2 = low << 8;
p->low = low2;
}
if (low < (UInt32)0xFF000000 || high != 0) if (low < (UInt32)0xFF000000 || high != 0)
{ {
{ {
@@ -958,7 +961,8 @@ static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, unsigned sym, unsigned posS
unsigned m; unsigned m;
unsigned bit; unsigned bit;
RC_BIT_0(rc, probs) RC_BIT_0(rc, probs)
probs += (posState << (1 + kLenNumLowBits)); posState <<= (1 + kLenNumLowBits);
probs += posState;
bit = (sym >> 2) ; RC_BIT(rc, probs + 1, bit) m = (1 << 1) + bit; bit = (sym >> 2) ; RC_BIT(rc, probs + 1, bit) m = (1 << 1) + bit;
bit = (sym >> 1) & 1; RC_BIT(rc, probs + m, bit) m = (m << 1) + bit; bit = (sym >> 1) & 1; RC_BIT(rc, probs + m, bit) m = (m << 1) + bit;
bit = sym & 1; RC_BIT(rc, probs + m, bit) bit = sym & 1; RC_BIT(rc, probs + m, bit)
@@ -1000,7 +1004,8 @@ Z7_NO_INLINE static void Z7_FASTCALL LenPriceEnc_UpdateTables(
for (posState = 0; posState < numPosStates; posState++) for (posState = 0; posState < numPosStates; posState++)
{ {
UInt32 *prices = p->prices[posState]; UInt32 *prices = p->prices[posState];
const CLzmaProb *probs = enc->low + (posState << (1 + kLenNumLowBits)); const unsigned posState2 = posState << (1 + kLenNumLowBits);
const CLzmaProb *probs = enc->low + posState2;
SetPrices_3(probs, a, prices, ProbPrices); SetPrices_3(probs, a, prices, ProbPrices);
SetPrices_3(probs + kLenNumLowSymbols, c, prices + kLenNumLowSymbols, ProbPrices); SetPrices_3(probs + kLenNumLowSymbols, c, prices + kLenNumLowSymbols, ProbPrices);
} }
@@ -2220,7 +2225,7 @@ Z7_NO_INLINE static void FillAlignPrices(CLzmaEnc *p)
UInt32 prob; UInt32 prob;
bit = sym & 1; sym >>= 1; price += GET_PRICEa(probs[m], bit); m = (m << 1) + bit; bit = sym & 1; sym >>= 1; price += GET_PRICEa(probs[m], bit); m = (m << 1) + bit;
bit = sym & 1; sym >>= 1; price += GET_PRICEa(probs[m], bit); m = (m << 1) + bit; bit = sym & 1; sym >>= 1; price += GET_PRICEa(probs[m], bit); m = (m << 1) + bit;
bit = sym & 1; sym >>= 1; price += GET_PRICEa(probs[m], bit); m = (m << 1) + bit; bit = sym & 1; price += GET_PRICEa(probs[m], bit); m = (m << 1) + bit;
prob = probs[m]; prob = probs[m];
p->alignPrices[i ] = price + GET_PRICEa_0(prob); p->alignPrices[i ] = price + GET_PRICEa_0(prob);
p->alignPrices[i + 8] = price + GET_PRICEa_1(prob); p->alignPrices[i + 8] = price + GET_PRICEa_1(prob);
+5 -2
View File
@@ -1,5 +1,5 @@
/* Ppmd7Enc.c -- Ppmd7z (PPMdH with 7z Range Coder) Encoder /* Ppmd7Enc.c -- Ppmd7z (PPMdH with 7z Range Coder) Encoder
2023-09-07 : Igor Pavlov : Public domain : Igor Pavlov : Public domain
This code is based on: This code is based on:
PPMd var.H (2001): Dmitry Shkarin : Public domain */ PPMd var.H (2001): Dmitry Shkarin : Public domain */
@@ -35,7 +35,10 @@ static void Ppmd7z_RangeEnc_ShiftLow(CPpmd7 *p)
R->Cache = (Byte)((UInt32)R->Low >> 24); R->Cache = (Byte)((UInt32)R->Low >> 24);
} }
R->CacheSize++; R->CacheSize++;
R->Low = (UInt32)((UInt32)R->Low << 8); {
const UInt32 low2 = (UInt32)R->Low << 8;
R->Low = low2;
}
} }
#define RC_NORM_BASE(p) if (R->Range < kTopValue) { R->Range <<= 8; Ppmd7z_RangeEnc_ShiftLow(p); #define RC_NORM_BASE(p) if (R->Range < kTopValue) { R->Range <<= 8; Ppmd7z_RangeEnc_ShiftLow(p);