diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2022-03-18 15:06:16 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2022-03-18 15:06:16 +0900 |
commit | 86a87b80ebe4e7e299d68920467c7bbd8952d6a0 (patch) | |
tree | 5f8c303f263ec19e125fbe12d4b3dee9207f5d16 | |
parent | 16e5bf76ad4deb00ab2b84f37d254fce210ad40a (diff) | |
download | cmake-tizen_7.0_base_hotfix.tar.gz cmake-tizen_7.0_base_hotfix.tar.bz2 cmake-tizen_7.0_base_hotfix.zip |
feat: Apply security patchtizen_7.0_m2_releasesubmit/tizen_base/20220318.061037submit/tizen_7.0_base_hotfix/20221115.161501submit/tizen_7.0_base/20221028.200901accepted/tizen/base/tool/20220321.221720accepted/tizen/7.0/base/tool/hotfix/20221115.084811accepted/tizen/7.0/base/tool/20221028.113017accepted/tizen/7.0/base/hotfix/20230714.003702accepted/tizen/7.0/base/20230714.002847tizen_7.0_base_hotfixtizen_7.0_baseaccepted/tizen_7.0_base_tool_hotfixaccepted/tizen_7.0_base_toolaccepted/tizen_7.0_base_hotfixaccepted/tizen_7.0_base
CVE-2016-9840
CVE-2016-9841
CVE-2016-9843
Change-Id: I64d382b643dca66bede1d1ff4e31dafa32dbf12a
-rw-r--r-- | packaging/CVE-2016-9840.patch | 71 | ||||
-rw-r--r-- | packaging/CVE-2016-9841.patch | 204 | ||||
-rw-r--r-- | packaging/CVE-2016-9843.patch | 49 | ||||
-rw-r--r-- | packaging/cmake.spec | 6 |
4 files changed, 330 insertions, 0 deletions
diff --git a/packaging/CVE-2016-9840.patch b/packaging/CVE-2016-9840.patch new file mode 100644 index 000000000..22ba47f58 --- /dev/null +++ b/packaging/CVE-2016-9840.patch @@ -0,0 +1,71 @@ +From 6a043145ca6e9c55184013841a67b2fef87e44c0 Mon Sep 17 00:00:00 2001 +From: Mark Adler <madler@alumni.caltech.edu> +Date: Wed, 21 Sep 2016 23:35:50 -0700 +Subject: [PATCH] Remove offset pointer optimization in inftrees.c. + +inftrees.c was subtracting an offset from a pointer to an array, +in order to provide a pointer that allowed indexing starting at +the offset. This is not compliant with the C standard, for which +the behavior of a pointer decremented before its allocated memory +is undefined. Per the recommendation of a security audit of the +zlib code by Trail of Bits and TrustInSoft, in support of the +Mozilla Foundation, this tiny optimization was removed, in order +to avoid the possibility of undefined behavior. +--- + inftrees.c | 18 ++++++++---------- + 1 file changed, 8 insertions(+), 10 deletions(-) + +diff --git a/Utilities/cmzlib/inftrees.c b/Utilities/cmzlib/inftrees.c +index 8a9c13ff..6ac17854 100644 +--- a/Utilities/cmzlib/inftrees.c ++++ b/Utilities/cmzlib/inftrees.c +@@ -54,7 +54,7 @@ unsigned short FAR *work; + code FAR *next; /* next available space in table */ + const unsigned short FAR *base; /* base value table to use */ + const unsigned short FAR *extra; /* extra bits table to use */ +- int end; /* use base and extra for symbol > end */ ++ unsigned match; /* use base and extra for symbol >= match */ + unsigned short count[MAXBITS+1]; /* number of codes of each length */ + unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ + static const unsigned short lbase[31] = { /* Length codes 257..285 base */ +@@ -182,19 +182,18 @@ unsigned short FAR *work; + switch (type) { + case CODES: + base = extra = work; /* dummy value--not used */ +- end = 19; ++ match = 20; + break; + case LENS: + base = lbase; + base -= 257; + extra = lext; +- extra -= 257; +- end = 256; ++ match = 257; + break; + default: /* DISTS */ + base = dbase; + extra = dext; +- end = -1; ++ match = 0; + } + + /* initialize state for loop */ +@@ -216,13 +215,13 @@ unsigned short FAR *work; + for (;;) { + /* create table entry */ + this.bits = (unsigned char)(len - drop); +- if ((int)(work[sym]) < end) { ++ if (work[sym] + 1 < match) { + this.op = (unsigned char)0; + this.val = work[sym]; + } +- else if ((int)(work[sym]) > end) { +- this.op = (unsigned char)(extra[work[sym]]); +- this.val = base[work[sym]]; ++ else if (work[sym] >= match) { ++ this.op = (unsigned char)(extra[work[sym] - match]); ++ this.val = base[work[sym] - match]; + } + else { + this.op = (unsigned char)(32 + 64); /* end of block */ diff --git a/packaging/CVE-2016-9841.patch b/packaging/CVE-2016-9841.patch new file mode 100644 index 000000000..b9f7827ff --- /dev/null +++ b/packaging/CVE-2016-9841.patch @@ -0,0 +1,204 @@ +From 9aaec95e82117c1cb0f9624264c3618fc380cecb Mon Sep 17 00:00:00 2001 +From: Mark Adler <madler@alumni.caltech.edu> +Date: Wed, 21 Sep 2016 22:25:21 -0700 +Subject: [PATCH] Use post-increment only in inffast.c. + +An old inffast.c optimization turns out to not be optimal anymore +with modern compilers, and furthermore was not compliant with the +C standard, for which decrementing a pointer before its allocated +memory is undefined. Per the recommendation of a security audit of +the zlib code by Trail of Bits and TrustInSoft, in support of the +Mozilla Foundation, this "optimization" was removed, in order to +avoid the possibility of undefined behavior. +--- + inffast.c | 81 +++++++++++++++++++++---------------------------------- + 1 file changed, 31 insertions(+), 50 deletions(-) + +diff --git a/Utilities/cmzlib/inffast.c b/Utilities/cmzlib/inffast.c +index bbee92ed..da0677aa 100644 +--- a/Utilities/cmzlib/inffast.c ++++ b/Utilities/cmzlib/inffast.c +@@ -10,25 +10,6 @@ + + #ifndef ASMINF + +-/* Allow machine dependent optimization for post-increment or pre-increment. +- Based on testing to date, +- Pre-increment preferred for: +- - PowerPC G3 (Adler) +- - MIPS R5000 (Randers-Pehrson) +- Post-increment preferred for: +- - none +- No measurable difference: +- - Pentium III (Anderson) +- - M68060 (Nikl) +- */ +-#ifdef POSTINC +-# define OFF 0 +-# define PUP(a) *(a)++ +-#else +-# define OFF 1 +-# define PUP(a) *++(a) +-#endif +- + /* + Decode literal, length, and distance codes and write out the resulting + literal and match bytes until either not enough input or output is +@@ -96,9 +77,9 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ + + /* copy state to local variables */ + state = (struct inflate_state FAR *)strm->state; +- in = strm->next_in - OFF; ++ in = strm->next_in; + last = in + (strm->avail_in - 5); +- out = strm->next_out - OFF; ++ out = strm->next_out; + beg = out - (start - strm->avail_out); + end = out + (strm->avail_out - 257); + #ifdef INFLATE_STRICT +@@ -119,9 +100,9 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ + input data or output space */ + do { + if (bits < 15) { +- hold += (unsigned long)(PUP(in)) << bits; ++ hold += (unsigned long)(*in++) << bits; + bits += 8; +- hold += (unsigned long)(PUP(in)) << bits; ++ hold += (unsigned long)(*in++) << bits; + bits += 8; + } + this = lcode[hold & lmask]; +@@ -134,14 +115,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ + Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", this.val)); +- PUP(out) = (unsigned char)(this.val); ++ *out++ = (unsigned char)(this.val); + } + else if (op & 16) { /* length base */ + len = (unsigned)(this.val); + op &= 15; /* number of extra bits */ + if (op) { + if (bits < op) { +- hold += (unsigned long)(PUP(in)) << bits; ++ hold += (unsigned long)(*in++) << bits; + bits += 8; + } + len += (unsigned)hold & ((1U << op) - 1); +@@ -150,9 +131,9 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ + } + Tracevv((stderr, "inflate: length %u\n", len)); + if (bits < 15) { +- hold += (unsigned long)(PUP(in)) << bits; ++ hold += (unsigned long)(*in++) << bits; + bits += 8; +- hold += (unsigned long)(PUP(in)) << bits; ++ hold += (unsigned long)(*in++) << bits; + bits += 8; + } + this = dcode[hold & dmask]; +@@ -165,10 +146,10 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ + dist = (unsigned)(this.val); + op &= 15; /* number of extra bits */ + if (bits < op) { +- hold += (unsigned long)(PUP(in)) << bits; ++ hold += (unsigned long)(*in++) << bits; + bits += 8; + if (bits < op) { +- hold += (unsigned long)(PUP(in)) << bits; ++ hold += (unsigned long)(*in++) << bits; + bits += 8; + } + } +@@ -191,13 +172,13 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ + state->mode = BAD; + break; + } +- from = window - OFF; ++ from = window; + if (write == 0) { /* very common case */ + from += wsize - op; + if (op < len) { /* some from window */ + len -= op; + do { +- PUP(out) = PUP(from); ++ *out++ = *from++; + } while (--op); + from = out - dist; /* rest from output */ + } +@@ -208,14 +189,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ + if (op < len) { /* some from end of window */ + len -= op; + do { +- PUP(out) = PUP(from); ++ *out++ = *from++; + } while (--op); +- from = window - OFF; ++ from = window; + if (write < len) { /* some from start of window */ + op = write; + len -= op; + do { +- PUP(out) = PUP(from); ++ *out++ = *from++; + } while (--op); + from = out - dist; /* rest from output */ + } +@@ -226,35 +207,35 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ + if (op < len) { /* some from window */ + len -= op; + do { +- PUP(out) = PUP(from); ++ *out++ = *from++; + } while (--op); + from = out - dist; /* rest from output */ + } + } + while (len > 2) { +- PUP(out) = PUP(from); +- PUP(out) = PUP(from); +- PUP(out) = PUP(from); ++ *out++ = *from++; ++ *out++ = *from++; ++ *out++ = *from++; + len -= 3; + } + if (len) { +- PUP(out) = PUP(from); ++ *out++ = *from++; + if (len > 1) +- PUP(out) = PUP(from); ++ *out++ = *from++; + } + } + else { + from = out - dist; /* copy direct from output */ + do { /* minimum length is three */ +- PUP(out) = PUP(from); +- PUP(out) = PUP(from); +- PUP(out) = PUP(from); ++ *out++ = *from++; ++ *out++ = *from++; ++ *out++ = *from++; + len -= 3; + } while (len > 2); + if (len) { +- PUP(out) = PUP(from); ++ *out++ = *from++; + if (len > 1) +- PUP(out) = PUP(from); ++ *out++ = *from++; + } + } + } +@@ -291,8 +272,8 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ + hold &= (1U << bits) - 1; + + /* update state and return */ +- strm->next_in = in + OFF; +- strm->next_out = out + OFF; ++ strm->next_in = in; ++ strm->next_out = out; + strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); + strm->avail_out = (unsigned)(out < end ? + 257 + (end - out) : 257 - (out - end)); diff --git a/packaging/CVE-2016-9843.patch b/packaging/CVE-2016-9843.patch new file mode 100644 index 000000000..27db8b8ed --- /dev/null +++ b/packaging/CVE-2016-9843.patch @@ -0,0 +1,49 @@ +From d1d577490c15a0c6862473d7576352a9f18ef811 Mon Sep 17 00:00:00 2001 +From: Mark Adler <madler@alumni.caltech.edu> +Date: Wed, 28 Sep 2016 20:20:25 -0700 +Subject: [PATCH] Avoid pre-decrement of pointer in big-endian CRC calculation. + +There was a small optimization for PowerPCs to pre-increment a +pointer when accessing a word, instead of post-incrementing. This +required prefacing the loop with a decrement of the pointer, +possibly pointing before the object passed. This is not compliant +with the C standard, for which decrementing a pointer before its +allocated memory is undefined. When tested on a modern PowerPC +with a modern compiler, the optimization no longer has any effect. +Due to all that, and per the recommendation of a security audit of +the zlib code by Trail of Bits and TrustInSoft, in support of the +Mozilla Foundation, this "optimization" was removed, in order to +avoid the possibility of undefined behavior. +--- + crc32.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/Utilities/cmzlib/crc32.c b/Utilities/cmzlib/crc32.c +index f658a9ef..704b7480 100644 +--- a/Utilities/cmzlib/crc32.c ++++ b/Utilities/cmzlib/crc32.c +@@ -293,7 +293,7 @@ local unsigned long crc32_little(crc, buf, len) + } + + /* ========================================================================= */ +-#define DOBIG4 c ^= *++buf4; \ ++#define DOBIG4 c ^= *buf4++; \ + c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ + crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] + #define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 +@@ -315,7 +315,6 @@ local unsigned long crc32_big(crc, buf, len) + } + + buf4 = (const u4 FAR *)(const void FAR *)buf; +- buf4--; + while (len >= 32) { + DOBIG32; + len -= 32; +@@ -324,7 +323,6 @@ local unsigned long crc32_big(crc, buf, len) + DOBIG4; + len -= 4; + } +- buf4++; + buf = (const unsigned char FAR *)buf4; + + if (len) do { diff --git a/packaging/cmake.spec b/packaging/cmake.spec index ab3ebeece..968fa18e0 100644 --- a/packaging/cmake.spec +++ b/packaging/cmake.spec @@ -8,6 +8,9 @@ Group: Platfrom Development/Tools Source0: %{name}-%{version}.tar.gz Source1: macros.cmake Source2: TizenCommon.cmake +Source11: CVE-2016-9840.patch +Source12: CVE-2016-9841.patch +Source13: CVE-2016-9843.patch Source1001: cmake.manifest BuildRequires: fdupes @@ -32,6 +35,9 @@ template instantiation. %prep %setup -q -n cmake-%{version} cp %{SOURCE1001} . +%{__patch} -p1 < %{SOURCE11} +%{__patch} -p1 < %{SOURCE12} +%{__patch} -p1 < %{SOURCE13} %build export CXXFLAGS="$RPM_OPT_FLAGS" |