summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2024-12-20 00:03:58 +0800
committerKhem Raj <raj.khem@gmail.com>2024-12-19 09:41:31 -0800
commit4cac1be12dd0221515951642d8c4362bf9a8b4d7 (patch)
tree454b33509bcbb2ccc5d5c94bcbb681aadfcaa247
parente0f745b45e3c0402a64e35e94abff6a32791cb04 (diff)
downloadmeta-openembedded-4cac1be12dd0221515951642d8c4362bf9a8b4d7.tar.gz
Use 7zip 24.09 to replace p7zip 16.02
According to DOC/readme.txt [1]: 7-Zip and p7zip =============== Now there are two different ports of 7-Zip for Linux/macOS: 1) p7zip - another port of 7-Zip for Linux, made by an independent developer. The latest version of p7zip now is 16.02, and that p7zip 16.02 is outdated now. http://sourceforge.net/projects/p7zip/ 2) 7-Zip for Linux/macOS - this package - it's new code with all changes from latest 7-Zip for Windows Add recipe 7-zip [2] to instead of recipe p7zip[3] in which the upstream is dead since 2016 Use git repo to instead of tarball Drop obsolete patches - CVE-2016-9296.patch - CVE-2017-17969.patch - CVE-2018-5996.patch - change_numMethods_from_bool_to_unsigned.patch - 0001-Fix-two-buffer-overflow-vulnerabilities.patch - 0001-Fix-narrowing-errors-Wc-11-narrowing.patch License-Update: DOC/License.txt: Add BSD-2-Clause & BSD-3-Clause The codec libraries was removed since 21.02 [4] Refer debian to compile 7-zip [5] Add link 7z.so to lib7z.so and create wrapper to command 7z which required running with absolute path to link the library 7z.so [1] https://salsa.debian.org/debian/7zip/-/blob/master/DOC/readme.txt?ref_type=heads [2] https://sourceforge.net/projects/p7zip/ [3] https://www.7-zip.org/ [4] https://github.com/p7zip-project/p7zip/commit/6c6ed1eba9ff0c0ded9323600f1f3c686d6b6692 [5] https://salsa.debian.org/debian/7zip/-/blob/master/debian/rules Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-oe/recipes-extended/7zip/7zip_24.09.bb56
-rw-r--r--meta-oe/recipes-extended/7zip/files/0001-support-yocto-cross-compiling.patch51
-rwxr-xr-xmeta-oe/recipes-extended/7zip/files/7z_wrapper.sh4
-rw-r--r--meta-oe/recipes-extended/p7zip/files/0001-Fix-narrowing-errors-Wc-11-narrowing.patch49
-rw-r--r--meta-oe/recipes-extended/p7zip/files/CVE-2016-9296.patch27
-rw-r--r--meta-oe/recipes-extended/p7zip/files/CVE-2017-17969.patch40
-rw-r--r--meta-oe/recipes-extended/p7zip/files/CVE-2018-5996.patch227
-rw-r--r--meta-oe/recipes-extended/p7zip/files/change_numMethods_from_bool_to_unsigned.patch34
-rw-r--r--meta-oe/recipes-extended/p7zip/files/do_not_override_compiler_and_do_not_strip.patch38
-rw-r--r--meta-oe/recipes-extended/p7zip/p7zip_16.02.bb46
10 files changed, 111 insertions, 461 deletions
diff --git a/meta-oe/recipes-extended/7zip/7zip_24.09.bb b/meta-oe/recipes-extended/7zip/7zip_24.09.bb
new file mode 100644
index 0000000000..2ccec78404
--- /dev/null
+++ b/meta-oe/recipes-extended/7zip/7zip_24.09.bb
@@ -0,0 +1,56 @@
1SUMMARY = "7-zip is a commandline utility handling 7z archives."
2HOMEPAGE = "http://www.7-zip.org/"
3LICENSE = "LGPL-2.1-or-later & unRAR & PD & BSD-2-Clause & BSD-3-Clause"
4LIC_FILES_CHKSUM = "file://DOC/copying.txt;md5=4fbd65380cdd255951079008b364516c \
5 file://DOC/unRarLicense.txt;md5=9c87ddde469ef94aed153b0951d088de \
6 file://DOC/License.txt;md5=44483e232b64ffca25fe001f3d6418d0"
7
8CVE_PRODUCT = "7-zip 7zip"
9SRC_URI = "git://github.com/ip7z/7zip.git;protocol=https;branch=main \
10 file://0001-support-yocto-cross-compiling.patch \
11 file://7z_wrapper.sh \
12 "
13SRCREV = "e5431fa6f5505e385c6f9367260717e9c47dc2ee"
14
15UPSTREAM_CHECK_URI = "https://github.com/ip7z/7zip/releases/latest"
16
17S = "${WORKDIR}/git"
18
19# Support Yocto cross compiling
20EXTRA_OEMAKE += " \
21 CXXFLAGS_EXTRA='${CXXFLAGS}' \
22 CFLAGS_BASE2='${CFLAGS}' \
23 LDFLAGS_STATIC_3='${LDFLAGS}' \
24"
25
26do_compile() {
27 oe_runmake -C CPP/7zip/Bundles/Alone2 -f ../../cmpl_gcc.mak
28 oe_runmake -C CPP/7zip/Bundles/Format7zF -f ../../cmpl_gcc.mak
29 oe_runmake -C CPP/7zip/UI/Console -f ../../cmpl_gcc.mak
30 oe_runmake -C CPP/7zip/Bundles/SFXCon -f ../../cmpl_gcc.mak
31 oe_runmake -C CPP/7zip/Bundles/Alone -f ../../cmpl_gcc.mak
32 oe_runmake -C CPP/7zip/Bundles/Alone7z -f ../../cmpl_gcc.mak
33}
34
35FILES:${PN} += "${libdir}/*"
36
37FILES_SOLIBSDEV = ""
38INSANE_SKIP:${PN} += "dev-so"
39
40do_install() {
41 install -d ${D}${bindir}
42 install -m 0755 ${S}/CPP/7zip/Bundles/Alone/b/g/7za ${D}${bindir}
43 install -m 0755 ${S}/CPP/7zip/Bundles/Alone7z/b/g/7zr ${D}${bindir}
44 install -m 0755 ${S}/CPP/7zip/UI/Console/b/g/7z ${D}${bindir}/7z.real
45 install -m 0755 ${UNPACKDIR}/7z_wrapper.sh ${D}${bindir}/7z
46
47 install -d ${D}${libdir}
48 install -m 0755 ${S}/CPP/7zip/Bundles/Format7zF/b/g/7z.so ${D}${libdir}/lib7z.so
49 ln -rsn ${D}${libdir}/lib7z.so ${D}${bindir}/7z.so
50}
51
52PROVIDES += "p7zip"
53RPROVIDES:${PN} += "lib7z.so()(64bit) 7z lib7z.so p7zip"
54RPROVIDES:${PN}-dev += "lib7z.so()(64bit) 7z lib7z.so"
55
56BBCLASSEXTEND = "native nativesdk"
diff --git a/meta-oe/recipes-extended/7zip/files/0001-support-yocto-cross-compiling.patch b/meta-oe/recipes-extended/7zip/files/0001-support-yocto-cross-compiling.patch
new file mode 100644
index 0000000000..06908e94fe
--- /dev/null
+++ b/meta-oe/recipes-extended/7zip/files/0001-support-yocto-cross-compiling.patch
@@ -0,0 +1,51 @@
1From fd0d54f96576a8ff572bb7c7d28df6b097f99a30 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Wed, 18 Dec 2024 16:38:11 +0800
4Subject: [PATCH] support yocto cross compiling
5
6Remove -s from $LFLAGS_STRIP, do not strip binary to workaournd
7Yocto build warning
8...
9WARNING: 7zip-native-24.09-r0 do_populate_sysroot: File 'tmp/work/x86_64-linux/
107zip-native/24.09/recipe-sysroot-native/usr/lib/7z.so' from 7zip-native was already stripped,
11this will prevent future debugging!
12...
13
14Apply CC, CXX from environments
15
16Upstream-Status: Inappropriate [Yocto specific]
17
18Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
19---
20 CPP/7zip/7zip_gcc.mak | 2 +-
21 CPP/7zip/var_gcc.mak | 2 --
22 2 files changed, 1 insertion(+), 3 deletions(-)
23
24diff --git a/CPP/7zip/7zip_gcc.mak b/CPP/7zip/7zip_gcc.mak
25index bcb06a0..297f0a8 100644
26--- a/CPP/7zip/7zip_gcc.mak
27+++ b/CPP/7zip/7zip_gcc.mak
28@@ -45,7 +45,7 @@ CFLAGS_DEBUG = -g
29 else
30 CFLAGS_DEBUG = -DNDEBUG
31 ifneq ($(CC), $(CROSS_COMPILE)clang)
32-LFLAGS_STRIP = -s
33+LFLAGS_STRIP =
34 endif
35 endif
36
37diff --git a/CPP/7zip/var_gcc.mak b/CPP/7zip/var_gcc.mak
38index 664491c..6d0f485 100644
39--- a/CPP/7zip/var_gcc.mak
40+++ b/CPP/7zip/var_gcc.mak
41@@ -6,7 +6,5 @@ IS_ARM64=
42 CROSS_COMPILE=
43 MY_ARCH=
44 USE_ASM=
45-CC=$(CROSS_COMPILE)gcc
46-CXX=$(CROSS_COMPILE)g++
47
48 # -march=armv8-a+crc+crypto
49--
502.34.1
51
diff --git a/meta-oe/recipes-extended/7zip/files/7z_wrapper.sh b/meta-oe/recipes-extended/7zip/files/7z_wrapper.sh
new file mode 100755
index 0000000000..af5b9b393a
--- /dev/null
+++ b/meta-oe/recipes-extended/7zip/files/7z_wrapper.sh
@@ -0,0 +1,4 @@
1#!/bin/sh
2realpath=`readlink -fn $0`
3realdir=`dirname $realpath`
4exec $realdir/7z.real "$@"
diff --git a/meta-oe/recipes-extended/p7zip/files/0001-Fix-narrowing-errors-Wc-11-narrowing.patch b/meta-oe/recipes-extended/p7zip/files/0001-Fix-narrowing-errors-Wc-11-narrowing.patch
deleted file mode 100644
index 1f08d1603a..0000000000
--- a/meta-oe/recipes-extended/p7zip/files/0001-Fix-narrowing-errors-Wc-11-narrowing.patch
+++ /dev/null
@@ -1,49 +0,0 @@
1From 653674e11872465dd5edf1c1e8413ea813d7e086 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 23 Apr 2018 23:07:21 -0700
4Subject: [PATCH] Fix narrowing errors -Wc++11-narrowing
5
6Clang 6.x finds these errors
7
8 ../../../../CPP/Windows/ErrorMsg.cpp:24:10: error: case value evaluates to -2147024809, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
9 case E_INVALIDARG : txt = "E_INVALIDARG"; break ;
10 ^
11
12HRESULT causes the macro to be parsed as a signed long, so we need to force it
13to be checked as an unsigned long instead.
14
15also reported here https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224930
16
17Upstream-Status: Pending
18
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20
21---
22 CPP/Windows/ErrorMsg.cpp | 14 +++++++-------
23 1 file changed, 7 insertions(+), 7 deletions(-)
24
25diff --git a/CPP/Windows/ErrorMsg.cpp b/CPP/Windows/ErrorMsg.cpp
26index 99684ae..78a64ba 100644
27--- a/CPP/Windows/ErrorMsg.cpp
28+++ b/CPP/Windows/ErrorMsg.cpp
29@@ -15,13 +15,13 @@ UString MyFormatMessage(DWORD errorCode)
30
31 switch(errorCode) {
32 case ERROR_NO_MORE_FILES : txt = "No more files"; break ;
33- case E_NOTIMPL : txt = "E_NOTIMPL"; break ;
34- case E_NOINTERFACE : txt = "E_NOINTERFACE"; break ;
35- case E_ABORT : txt = "E_ABORT"; break ;
36- case E_FAIL : txt = "E_FAIL"; break ;
37- case STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ;
38- case E_OUTOFMEMORY : txt = "E_OUTOFMEMORY"; break ;
39- case E_INVALIDARG : txt = "E_INVALIDARG"; break ;
40+ case (DWORD) E_NOTIMPL : txt = "E_NOTIMPL"; break ;
41+ case (DWORD) E_NOINTERFACE : txt = "E_NOINTERFACE"; break ;
42+ case (DWORD) E_ABORT : txt = "E_ABORT"; break ;
43+ case (DWORD) E_FAIL : txt = "E_FAIL"; break ;
44+ case (DWORD) STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ;
45+ case (DWORD) E_OUTOFMEMORY : txt = "E_OUTOFMEMORY"; break ;
46+ case (DWORD) E_INVALIDARG : txt = "E_INVALIDARG"; break ;
47 case ERROR_DIRECTORY : txt = "Error Directory"; break ;
48 default:
49 txt = strerror(errorCode);
diff --git a/meta-oe/recipes-extended/p7zip/files/CVE-2016-9296.patch b/meta-oe/recipes-extended/p7zip/files/CVE-2016-9296.patch
deleted file mode 100644
index 98e186cbf0..0000000000
--- a/meta-oe/recipes-extended/p7zip/files/CVE-2016-9296.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1p7zip: Update CVE-2016-9296 patch URL.
2From: Robert Luberda <robert@debian.org>
3Date: Sat, 19 Nov 2016 08:48:08 +0100
4Subject: Fix nullptr dereference (CVE-2016-9296)
5
6Patch taken from https://sourceforge.net/p/p7zip/bugs/185/
7This patch file taken from Debian's patch set for p7zip
8
9Upstream-Status: Backport [https://sourceforge.net/p/p7zip/bugs/185/]
10CVE: CVE-2016-9296
11
12Signed-off-by: Virendra Thakur <virendra.thakur@kpit.com>
13
14Index: p7zip_16.02/CPP/7zip/Archive/7z/7zIn.cpp
15===================================================================
16--- p7zip_16.02.orig/CPP/7zip/Archive/7z/7zIn.cpp
17+++ p7zip_16.02/CPP/7zip/Archive/7z/7zIn.cpp
18@@ -1097,7 +1097,8 @@ HRESULT CInArchive::ReadAndDecodePackedS
19 if (CrcCalc(data, unpackSize) != folders.FolderCRCs.Vals[i])
20 ThrowIncorrect();
21 }
22- HeadersSize += folders.PackPositions[folders.NumPackStreams];
23+ if (folders.PackPositions)
24+ HeadersSize += folders.PackPositions[folders.NumPackStreams];
25 return S_OK;
26 }
27
diff --git a/meta-oe/recipes-extended/p7zip/files/CVE-2017-17969.patch b/meta-oe/recipes-extended/p7zip/files/CVE-2017-17969.patch
deleted file mode 100644
index 9ba1078071..0000000000
--- a/meta-oe/recipes-extended/p7zip/files/CVE-2017-17969.patch
+++ /dev/null
@@ -1,40 +0,0 @@
1From 7f2da4f810b429ddb7afa0e252e3d02ced0eba87 Mon Sep 17 00:00:00 2001
2From: Radovan Scasny <radovan.scasny@siemens.com>
3Date: Tue, 20 Feb 2018 12:08:13 +0100
4Subject: [PATCH] p7zip: Fix CVE-2017-17969
5
6[No upstream tracking] -- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=888297
7
8Heap-based buffer overflow in 7zip
9
10Compress/ShrinkDecoder.cpp: Heap-based buffer overflow
11in the NCompress::NShrink::CDecoder::CodeReal method
12in 7-Zip before 18.00 and p7zip allows remote attackers
13to cause a denial of service (out-of-bounds write)
14or potentially execute arbitrary code via a crafted ZIP archive.
15
16Upstream-Status: Backport [https://sourceforge.net/p/p7zip/bugs/_discuss/thread/0920f369/8316/attachment/CVE-2017-17969.patch]
17CVE: CVE-2017-17969
18Signed-off-by: Radovan Scasny <radovan.scasny@siemens.com>
19
20---
21 CPP/7zip/Compress/ShrinkDecoder.cpp | 5 +++++
22 1 file changed, 5 insertions(+)
23
24diff --git a/CPP/7zip/Compress/ShrinkDecoder.cpp b/CPP/7zip/Compress/ShrinkDecoder.cpp
25index 80b7e67..5bb0559 100644
26--- a/CPP/7zip/Compress/ShrinkDecoder.cpp
27+++ b/CPP/7zip/Compress/ShrinkDecoder.cpp
28@@ -121,7 +121,12 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
29 {
30 _stack[i++] = _suffixes[cur];
31 cur = _parents[cur];
32+ if (cur >= kNumItems || i >= kNumItems)
33+ break;
34 }
35+
36+ if (cur >= kNumItems || i >= kNumItems)
37+ break;
38
39 _stack[i++] = (Byte)cur;
40 lastChar2 = (Byte)cur;
diff --git a/meta-oe/recipes-extended/p7zip/files/CVE-2018-5996.patch b/meta-oe/recipes-extended/p7zip/files/CVE-2018-5996.patch
deleted file mode 100644
index 47868c982e..0000000000
--- a/meta-oe/recipes-extended/p7zip/files/CVE-2018-5996.patch
+++ /dev/null
@@ -1,227 +0,0 @@
1From: Robert Luberda <robert@debian.org>
2Date: Sun, 28 Jan 2018 23:47:40 +0100
3Subject: CVE-2018-5996
4
5Hopefully fix Memory Corruptions via RAR PPMd (CVE-2018-5996) by
6applying a few changes from 7Zip 18.00-beta.
7
8Bug-Debian: https://bugs.debian.org/#888314
9
10Upstream-Status: Backport [https://sources.debian.org/data/non-free/p/p7zip-rar/16.02-3/debian/patches/06-CVE-2018-5996.patch]
11CVE: CVE-2018-5996
12
13Signed-off-by: Virendra Thakur <virendra.thakur@kpit.com>
14---
15 CPP/7zip/Compress/Rar1Decoder.cpp | 13 +++++++++----
16 CPP/7zip/Compress/Rar1Decoder.h | 1 +
17 CPP/7zip/Compress/Rar2Decoder.cpp | 10 +++++++++-
18 CPP/7zip/Compress/Rar2Decoder.h | 1 +
19 CPP/7zip/Compress/Rar3Decoder.cpp | 23 ++++++++++++++++++++---
20 CPP/7zip/Compress/Rar3Decoder.h | 2 ++
21 6 files changed, 42 insertions(+), 8 deletions(-)
22
23diff --git a/CPP/7zip/Compress/Rar1Decoder.cpp b/CPP/7zip/Compress/Rar1Decoder.cpp
24index 1aaedcc..68030c7 100644
25--- a/CPP/7zip/Compress/Rar1Decoder.cpp
26+++ b/CPP/7zip/Compress/Rar1Decoder.cpp
27@@ -29,7 +29,7 @@ public:
28 };
29 */
30
31-CDecoder::CDecoder(): m_IsSolid(false) { }
32+CDecoder::CDecoder(): m_IsSolid(false), _errorMode(false) { }
33
34 void CDecoder::InitStructures()
35 {
36@@ -406,9 +406,14 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
37 InitData();
38 if (!m_IsSolid)
39 {
40+ _errorMode = false;
41 InitStructures();
42 InitHuff();
43 }
44+
45+ if (_errorMode)
46+ return S_FALSE;
47+
48 if (m_UnpackSize > 0)
49 {
50 GetFlagsBuf();
51@@ -477,9 +482,9 @@ STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream
52 const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
53 {
54 try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
55- catch(const CInBufferException &e) { return e.ErrorCode; }
56- catch(const CLzOutWindowException &e) { return e.ErrorCode; }
57- catch(...) { return S_FALSE; }
58+ catch(const CInBufferException &e) { _errorMode = true; return e.ErrorCode; }
59+ catch(const CLzOutWindowException &e) { _errorMode = true; return e.ErrorCode; }
60+ catch(...) { _errorMode = true; return S_FALSE; }
61 }
62
63 STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
64diff --git a/CPP/7zip/Compress/Rar1Decoder.h b/CPP/7zip/Compress/Rar1Decoder.h
65index 630f089..01b606b 100644
66--- a/CPP/7zip/Compress/Rar1Decoder.h
67+++ b/CPP/7zip/Compress/Rar1Decoder.h
68@@ -39,6 +39,7 @@ public:
69
70 Int64 m_UnpackSize;
71 bool m_IsSolid;
72+ bool _errorMode;
73
74 UInt32 ReadBits(int numBits);
75 HRESULT CopyBlock(UInt32 distance, UInt32 len);
76diff --git a/CPP/7zip/Compress/Rar2Decoder.cpp b/CPP/7zip/Compress/Rar2Decoder.cpp
77index b3f2b4b..0580c8d 100644
78--- a/CPP/7zip/Compress/Rar2Decoder.cpp
79+++ b/CPP/7zip/Compress/Rar2Decoder.cpp
80@@ -80,7 +80,8 @@ static const UInt32 kHistorySize = 1 << 20;
81 static const UInt32 kWindowReservSize = (1 << 22) + 256;
82
83 CDecoder::CDecoder():
84- m_IsSolid(false)
85+ m_IsSolid(false),
86+ m_TablesOK(false)
87 {
88 }
89
90@@ -100,6 +101,8 @@ UInt32 CDecoder::ReadBits(unsigned numBits) { return m_InBitStream.ReadBits(numB
91
92 bool CDecoder::ReadTables(void)
93 {
94+ m_TablesOK = false;
95+
96 Byte levelLevels[kLevelTableSize];
97 Byte newLevels[kMaxTableSize];
98 m_AudioMode = (ReadBits(1) == 1);
99@@ -170,6 +173,8 @@ bool CDecoder::ReadTables(void)
100 }
101
102 memcpy(m_LastLevels, newLevels, kMaxTableSize);
103+ m_TablesOK = true;
104+
105 return true;
106 }
107
108@@ -344,6 +349,9 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
109 return S_FALSE;
110 }
111
112+ if (!m_TablesOK)
113+ return S_FALSE;
114+
115 UInt64 startPos = m_OutWindowStream.GetProcessedSize();
116 while (pos < unPackSize)
117 {
118diff --git a/CPP/7zip/Compress/Rar2Decoder.h b/CPP/7zip/Compress/Rar2Decoder.h
119index 3a0535c..0e9005f 100644
120--- a/CPP/7zip/Compress/Rar2Decoder.h
121+++ b/CPP/7zip/Compress/Rar2Decoder.h
122@@ -139,6 +139,7 @@ class CDecoder :
123
124 UInt64 m_PackSize;
125 bool m_IsSolid;
126+ bool m_TablesOK;
127
128 void InitStructures();
129 UInt32 ReadBits(unsigned numBits);
130diff --git a/CPP/7zip/Compress/Rar3Decoder.cpp b/CPP/7zip/Compress/Rar3Decoder.cpp
131index 3bf2513..6cb8a6a 100644
132--- a/CPP/7zip/Compress/Rar3Decoder.cpp
133+++ b/CPP/7zip/Compress/Rar3Decoder.cpp
134@@ -92,7 +92,8 @@ CDecoder::CDecoder():
135 _writtenFileSize(0),
136 _vmData(0),
137 _vmCode(0),
138- m_IsSolid(false)
139+ m_IsSolid(false),
140+ _errorMode(false)
141 {
142 Ppmd7_Construct(&_ppmd);
143 }
144@@ -545,6 +546,9 @@ HRESULT CDecoder::ReadTables(bool &keepDecompressing)
145 return InitPPM();
146 }
147
148+ TablesRead = false;
149+ TablesOK = false;
150+
151 _lzMode = true;
152 PrevAlignBits = 0;
153 PrevAlignCount = 0;
154@@ -606,6 +610,9 @@ HRESULT CDecoder::ReadTables(bool &keepDecompressing)
155 }
156 }
157 }
158+ if (InputEofError())
159+ return S_FALSE;
160+
161 TablesRead = true;
162
163 // original code has check here:
164@@ -623,6 +630,9 @@ HRESULT CDecoder::ReadTables(bool &keepDecompressing)
165 RIF(m_LenDecoder.Build(&newLevels[kMainTableSize + kDistTableSize + kAlignTableSize]));
166
167 memcpy(m_LastLevels, newLevels, kTablesSizesSum);
168+
169+ TablesOK = true;
170+
171 return S_OK;
172 }
173
174@@ -824,7 +834,12 @@ HRESULT CDecoder::CodeReal(ICompressProgressInfo *progress)
175 PpmEscChar = 2;
176 PpmError = true;
177 InitFilters();
178+ _errorMode = false;
179 }
180+
181+ if (_errorMode)
182+ return S_FALSE;
183+
184 if (!m_IsSolid || !TablesRead)
185 {
186 bool keepDecompressing;
187@@ -838,6 +853,8 @@ HRESULT CDecoder::CodeReal(ICompressProgressInfo *progress)
188 bool keepDecompressing;
189 if (_lzMode)
190 {
191+ if (!TablesOK)
192+ return S_FALSE;
193 RINOK(DecodeLZ(keepDecompressing))
194 }
195 else
196@@ -901,8 +918,8 @@ STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream
197 _unpackSize = outSize ? *outSize : (UInt64)(Int64)-1;
198 return CodeReal(progress);
199 }
200- catch(const CInBufferException &e) { return e.ErrorCode; }
201- catch(...) { return S_FALSE; }
202+ catch(const CInBufferException &e) { _errorMode = true; return e.ErrorCode; }
203+ catch(...) { _errorMode = true; return S_FALSE; }
204 // CNewException is possible here. But probably CNewException is caused
205 // by error in data stream.
206 }
207diff --git a/CPP/7zip/Compress/Rar3Decoder.h b/CPP/7zip/Compress/Rar3Decoder.h
208index c130cec..2f72d7d 100644
209--- a/CPP/7zip/Compress/Rar3Decoder.h
210+++ b/CPP/7zip/Compress/Rar3Decoder.h
211@@ -192,6 +192,7 @@ class CDecoder:
212 UInt32 _lastFilter;
213
214 bool m_IsSolid;
215+ bool _errorMode;
216
217 bool _lzMode;
218 bool _unsupportedFilter;
219@@ -200,6 +201,7 @@ class CDecoder:
220 UInt32 PrevAlignCount;
221
222 bool TablesRead;
223+ bool TablesOK;
224
225 CPpmd7 _ppmd;
226 int PpmEscChar;
227
diff --git a/meta-oe/recipes-extended/p7zip/files/change_numMethods_from_bool_to_unsigned.patch b/meta-oe/recipes-extended/p7zip/files/change_numMethods_from_bool_to_unsigned.patch
deleted file mode 100644
index 93eb0588c0..0000000000
--- a/meta-oe/recipes-extended/p7zip/files/change_numMethods_from_bool_to_unsigned.patch
+++ /dev/null
@@ -1,34 +0,0 @@
1From 0820ef4b9238c1e39ae5bda32cc08cce3fd3ce89 Mon Sep 17 00:00:00 2001
2From: Nisha Parrakat <Nisha.Parrakat@kpit.com>
3Date: Wed, 26 May 2021 19:59:28 +0000
4Subject: [PATCH] fixes the below error
5
6| ../../../../CPP/7zip/Archive/Wim/WimHandler.cpp: In member function 'virtual LONG NArchive::NWim::CHandler::GetArchiveProperty(PROPID, PROPVARIANT*)':
7| ../../../../CPP/7zip/Archive/Wim/WimHandler.cpp:308:11: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
8| 308 | numMethods++;
9| | ^~~~~~~~~~
10| ../../../../CPP/7zip/Archive/Wim/WimHandler.cpp:318:9: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
11| 318 | numMethods++;
12
13use unsigned instead of bool
14Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
15
16Upstream-Status: Pending
17
18---
19 CPP/7zip/Archive/Wim/WimHandler.cpp | 2 +-
20 1 file changed, 1 insertion(+), 1 deletion(-)
21
22diff --git a/CPP/7zip/Archive/Wim/WimHandler.cpp b/CPP/7zip/Archive/Wim/WimHandler.cpp
23index 27d3298..4ff5cfe 100644
24--- a/CPP/7zip/Archive/Wim/WimHandler.cpp
25+++ b/CPP/7zip/Archive/Wim/WimHandler.cpp
26@@ -298,7 +298,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
27
28 AString res;
29
30- bool numMethods = 0;
31+ unsigned numMethods = 0;
32 for (unsigned i = 0; i < ARRAY_SIZE(k_Methods); i++)
33 {
34 if (methodMask & ((UInt32)1 << i))
diff --git a/meta-oe/recipes-extended/p7zip/files/do_not_override_compiler_and_do_not_strip.patch b/meta-oe/recipes-extended/p7zip/files/do_not_override_compiler_and_do_not_strip.patch
deleted file mode 100644
index 2636e7f6f4..0000000000
--- a/meta-oe/recipes-extended/p7zip/files/do_not_override_compiler_and_do_not_strip.patch
+++ /dev/null
@@ -1,38 +0,0 @@
1From b2aa209dfc5e59d6329b55b9764782334b63dbe8 Mon Sep 17 00:00:00 2001
2From: Raphael Freudiger <raphael.freudiger@siemens.com>
3Date: Wed, 11 Feb 2015 09:11:47 +0100
4Subject: [PATCH] do not override compiler and do not strip
5
6The default makefile sets the compiler to g++ or gcc. This leads to a wrong architecture when cross-compiling.
7Remove the hardcoded compiler and just append the flags to CXX and CC.
8
9Upstream-Status: Pending
10Signed-off-by: Raphael Freudiger <raphael.freudiger@siemens.com>
11Reviewed-By: Pascal Bach <pascal.bach@siemens.com>
12
13---
14 makefile.machine | 4 +---
15 1 file changed, 1 insertion(+), 3 deletions(-)
16
17diff --git a/makefile.machine b/makefile.machine
18index 9e34c34..e9244d9 100644
19--- a/makefile.machine
20+++ b/makefile.machine
21@@ -2,7 +2,7 @@
22 # makefile for Linux (x86, PPC, alpha ...)
23 #
24
25-OPTFLAGS=-O -s
26+OPTFLAGS=-O
27
28 ALLFLAGS=${OPTFLAGS} -pipe \
29 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
30@@ -10,8 +10,6 @@ ALLFLAGS=${OPTFLAGS} -pipe \
31 -D_7ZIP_LARGE_PAGES \
32 $(LOCAL_FLAGS)
33
34-CXX=g++
35-CC=gcc
36 CC_SHARED=-fPIC
37 LINK_SHARED=-fPIC -shared
38
diff --git a/meta-oe/recipes-extended/p7zip/p7zip_16.02.bb b/meta-oe/recipes-extended/p7zip/p7zip_16.02.bb
deleted file mode 100644
index 789819a5ec..0000000000
--- a/meta-oe/recipes-extended/p7zip/p7zip_16.02.bb
+++ /dev/null
@@ -1,46 +0,0 @@
1SUMMARY = "7-zip is a commandline utility handling 7z archives."
2HOMEPAGE = "http://www.7-zip.org/"
3LICENSE = "LGPL-2.1-or-later & unRAR"
4LIC_FILES_CHKSUM = "file://DOC/copying.txt;md5=4fbd65380cdd255951079008b364516c \
5 file://DOC/unRarLicense.txt;md5=9c87ddde469ef94aed153b0951d088de \
6 file://DOC/License.txt;md5=879598edf1f54dddb6930d7581357f8b"
7
8SRC_URI = "http://downloads.sourceforge.net/p7zip/p7zip/${PV}/p7zip_${PV}_src_all.tar.bz2 \
9 file://do_not_override_compiler_and_do_not_strip.patch \
10 file://CVE-2017-17969.patch \
11 file://0001-Fix-narrowing-errors-Wc-11-narrowing.patch \
12 file://change_numMethods_from_bool_to_unsigned.patch \
13 file://CVE-2018-5996.patch \
14 file://CVE-2016-9296.patch \
15 "
16
17SRC_URI[sha256sum] = "5eb20ac0e2944f6cb9c2d51dd6c4518941c185347d4089ea89087ffdd6e2341f"
18
19UPSTREAM_CHECK_URI = "https://tracker.debian.org/pkg/p7zip"
20UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)"
21
22S = "${WORKDIR}/${BPN}_${PV}"
23
24do_compile:append() {
25 oe_runmake 7z
26}
27FILES:${PN} += "${libdir}/* ${bindir}/7z"
28
29FILES_SOLIBSDEV = ""
30INSANE_SKIP:${PN} += "dev-so"
31
32do_install() {
33 install -d ${D}${bindir}
34 install -d ${D}${bindir}/Codecs
35 install -d ${D}${libdir}
36 install -d ${D}${libdir}/Codecs
37 install -m 0755 ${S}/bin/7za ${D}${bindir}
38 ln -s 7za ${D}${bindir}/7z
39 install -m 0755 ${S}/bin/Codecs/* ${D}${libdir}/Codecs/
40 install -m 0755 ${S}/bin/7z.so ${D}${libdir}/lib7z.so
41}
42
43RPROVIDES:${PN} += "lib7z.so()(64bit) 7z lib7z.so"
44RPROVIDES:${PN}-dev += "lib7z.so()(64bit) 7z lib7z.so"
45
46BBCLASSEXTEND = "native nativesdk"