summaryrefslogtreecommitdiff
path: root/media-libs/woff2
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/woff2')
-rw-r--r--media-libs/woff2/Manifest5
-rw-r--r--media-libs/woff2/files/woff2-1.0.2-aliasing.patch79
-rw-r--r--media-libs/woff2/files/woff2-1.0.2-gcc15.patch33
-rw-r--r--media-libs/woff2/woff2-1.0.2-r5.ebuild2
-rw-r--r--media-libs/woff2/woff2-1.0.2-r6.ebuild42
5 files changed, 159 insertions, 2 deletions
diff --git a/media-libs/woff2/Manifest b/media-libs/woff2/Manifest
index 6c10c45bf2fb..d4826791cc67 100644
--- a/media-libs/woff2/Manifest
+++ b/media-libs/woff2/Manifest
@@ -1,3 +1,6 @@
+AUX woff2-1.0.2-aliasing.patch 2961 BLAKE2B 75fc42d2c5e7b1eb5aaffb4b08a183e46aac8548f0d6c133ae9940158b6fce022bab53847585a321f22dccac1050d009d4c20ef7e1bba494f8b41f5acb711476 SHA512 e4d401713c5f409ad488762f26e5ce2837326905c4eb9b74eb04a7a93638e8c33bcb88377934fdc3a50b8a25b653af95dbe0524272d5328bacea23b062bf0b0b
+AUX woff2-1.0.2-gcc15.patch 1125 BLAKE2B 34e466c3b1e04c128c47d0b2197c657ee9d2f9ead6964e6195f8312ea78023b90c2d14b55749eae576d39380684ad296bfcca56bb13281b1ec91dd1344d6f15d SHA512 fc04809999fbb7312f351dbf76b2143f2f35c2501e985856e6286e02be9152735a4995573ebcef304905325f414879973e32c8786bb302764e82c9e823f52c3e
DIST woff2-1.0.2.tar.gz 38934 BLAKE2B b4a762cb2377b896147d9ebdae97f17e80bdb94fa8ec1b04e28e9df48c2f3456f83fc548b10a49bbc271bead349348f7582a85c5011f60a9feb4dda84920b6f3 SHA512 c788bba1530aec463e755e901f9342f4b599e3a07f54645fef1dc388ab5d5c30625535e5dd38e9e792e04a640574baa50eeefb6b7338ab403755f4a4e0c3044d
-EBUILD woff2-1.0.2-r5.ebuild 876 BLAKE2B a6803cb284df25b63d11e117534137639fd099c1c67eb2f98373838b795fb1026545d2558a4c0b3fbb5c8a0a6af7d40fdc9b01455ccd5b53a6f19f5cdfae329c SHA512 f52b1f5a8174a329013973e803df0756125048ddf55c50b1cba3425cc9023a219003ab150d8aa0f46fb6c7944f0a723ced988218b172af413a9cff6a4dccd60e
+EBUILD woff2-1.0.2-r5.ebuild 870 BLAKE2B f2c5698623a5661e6ed050568f1630fca601648fdb7d139a5b8f391b1c7efa4f4b042ca6107b9dd9fc88e57b1adcef0e447a1dae8c30a37f5146a3ba97583299 SHA512 72ad3354fef2aac0cd78ee175c1013d0b6b1f00695db187b3e86ea6a17538be9966fe84542db705dacbca0b39e9264daafe437c7bb3e0d36aec01ccfabbfcb8b
+EBUILD woff2-1.0.2-r6.ebuild 965 BLAKE2B 28c6aee49eaa9166c829087e3086f34f237410b35b080726187afc934df62c09509da6b42eff7cd92fd0f7bf697b294a98d14f50f870d191e749a1756011ae62 SHA512 508f80947220d4beb7ad51049d9d711d79c35eca8df90429a9c62c8ad9c00bd7d958c88b935c34dd74ed1d1ea93b591aaa7863ab05ee8cc62ed2e1a1fd5730fe
MISC metadata.xml 455 BLAKE2B bad7293e8ad355104222c80ab6e6ec1d1c816629b6f16ff78036da29a2e2f9fb3ccbd92d0da40646ee5fc405f3137ea8ef70cd5028b0107bf3b62e9c2b20de17 SHA512 1b18c1af59f53418fb6847d92bb2ba1a016995b550c63f08d8168fc93802d0326599c254428aa995b81db3b65833e378d6295bb6a49ec4a6329d11aef1b38163
diff --git a/media-libs/woff2/files/woff2-1.0.2-aliasing.patch b/media-libs/woff2/files/woff2-1.0.2-aliasing.patch
new file mode 100644
index 000000000000..5bc75b744559
--- /dev/null
+++ b/media-libs/woff2/files/woff2-1.0.2-aliasing.patch
@@ -0,0 +1,79 @@
+https://github.com/google/woff2/commit/23a34adec39d7cef30c1eebbf775a1ea5cc43c53
+
+From 23a34adec39d7cef30c1eebbf775a1ea5cc43c53 Mon Sep 17 00:00:00 2001
+From: David Benjamin <davidben@google.com>
+Date: Thu, 26 Oct 2023 10:16:05 -0400
+Subject: [PATCH] Fix undefined type-punning when loading/storing words
+
+Despite common practice, type-punning integer types out of buffers is
+undefined in C and C++. It's both a strict aliasing violation on access,
+and if the pointer isn't aligned, an alignment violation on cast. Being
+undefined, the compiler is allowed to arbitrarily miscompile the code
+when we rely on it.
+
+Instead, the two legal ways to pull a uint32_t out of a buffer are to
+either use memcpy, or load byte by byte and use shifts. In both cases,
+a good compiler should be smart enough to recognize what we're doing and
+generate reasonable code. Since there was already fallback code for the
+latter (for a middle-endian architecture?), I went ahead and switched to
+that.
+
+This change is needed to fix UBSan violations in Chromium.
+--- a/src/store_bytes.h
++++ b/src/store_bytes.h
+@@ -27,15 +27,8 @@ inline size_t StoreU32(uint8_t* dst, size_t offset, uint32_t x) {
+ }
+
+ inline size_t Store16(uint8_t* dst, size_t offset, int x) {
+-#if defined(WOFF_LITTLE_ENDIAN)
+- *reinterpret_cast<uint16_t*>(dst + offset) =
+- ((x & 0xFF) << 8) | ((x & 0xFF00) >> 8);
+-#elif defined(WOFF_BIG_ENDIAN)
+- *reinterpret_cast<uint16_t*>(dst + offset) = static_cast<uint16_t>(x);
+-#else
+ dst[offset] = x >> 8;
+ dst[offset + 1] = x;
+-#endif
+ return offset + 2;
+ }
+
+@@ -47,17 +40,8 @@ inline void StoreU32(uint32_t val, size_t* offset, uint8_t* dst) {
+ }
+
+ inline void Store16(int val, size_t* offset, uint8_t* dst) {
+-#if defined(WOFF_LITTLE_ENDIAN)
+- *reinterpret_cast<uint16_t*>(dst + *offset) =
+- ((val & 0xFF) << 8) | ((val & 0xFF00) >> 8);
+- *offset += 2;
+-#elif defined(WOFF_BIG_ENDIAN)
+- *reinterpret_cast<uint16_t*>(dst + *offset) = static_cast<uint16_t>(val);
+- *offset += 2;
+-#else
+ dst[(*offset)++] = val >> 8;
+ dst[(*offset)++] = val;
+-#endif
+ }
+
+ inline void StoreBytes(const uint8_t* data, size_t len,
+--- a/src/woff2_common.cc
++++ b/src/woff2_common.cc
+@@ -19,16 +19,8 @@ uint32_t ComputeULongSum(const uint8_t* buf, size_t size) {
+ uint32_t checksum = 0;
+ size_t aligned_size = size & ~3;
+ for (size_t i = 0; i < aligned_size; i += 4) {
+-#if defined(WOFF_LITTLE_ENDIAN)
+- uint32_t v = *reinterpret_cast<const uint32_t*>(buf + i);
+- checksum += (((v & 0xFF) << 24) | ((v & 0xFF00) << 8) |
+- ((v & 0xFF0000) >> 8) | ((v & 0xFF000000) >> 24));
+-#elif defined(WOFF_BIG_ENDIAN)
+- checksum += *reinterpret_cast<const uint32_t*>(buf + i);
+-#else
+- checksum += (buf[i] << 24) | (buf[i + 1] << 16) |
+- (buf[i + 2] << 8) | buf[i + 3];
+-#endif
++ checksum +=
++ (buf[i] << 24) | (buf[i + 1] << 16) | (buf[i + 2] << 8) | buf[i + 3];
+ }
+
+ // treat size not aligned on 4 as if it were padded to 4 with 0's
+
diff --git a/media-libs/woff2/files/woff2-1.0.2-gcc15.patch b/media-libs/woff2/files/woff2-1.0.2-gcc15.patch
new file mode 100644
index 000000000000..a8030e471aa2
--- /dev/null
+++ b/media-libs/woff2/files/woff2-1.0.2-gcc15.patch
@@ -0,0 +1,33 @@
+https://github.com/google/woff2/pull/176
+
+From 3905a7d9bc349786b458a71587a6176b241e682f Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyich@gmail.com>
+Date: Fri, 2 Aug 2024 22:12:03 +0100
+Subject: [PATCH] include/woff2/output.h: add missing <stdint.h> include
+
+Without the change `woff2` build fails on upcoming `gcc-15` as:
+
+ In file included from src/woff2_out.cc:9:
+ include/woff2/output.h:73:25: error: expected ')' before '*' token
+ 73 | WOFF2MemoryOut(uint8_t* buf, size_t buf_size);
+ | ~ ^
+ | )
+ include/woff2/output.h:79:3: error: 'uint8_t' does not name a type
+ 79 | uint8_t* buf_;
+ | ^~~~~~~
+ include/woff2/output.h:16:1: note: 'uint8_t' is defined in header '<cstdint>';
+ this is probably fixable by adding '#include <cstdint>'
+ 15 | #include <string>
+ +++ |+#include <cstdint>
+ 16 |
+--- a/include/woff2/output.h
++++ b/include/woff2/output.h
+@@ -12,6 +12,7 @@
+ #include <algorithm>
+ #include <cstring>
+ #include <memory>
++#include <stdint.h>
+ #include <string>
+
+ namespace woff2 {
+
diff --git a/media-libs/woff2/woff2-1.0.2-r5.ebuild b/media-libs/woff2/woff2-1.0.2-r5.ebuild
index c5b6d497ea5c..5fac984e13b3 100644
--- a/media-libs/woff2/woff2-1.0.2-r5.ebuild
+++ b/media-libs/woff2/woff2-1.0.2-r5.ebuild
@@ -11,7 +11,7 @@ SRC_URI="https://github.com/google/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
+KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
IUSE=""
RDEPEND="app-arch/brotli:="
diff --git a/media-libs/woff2/woff2-1.0.2-r6.ebuild b/media-libs/woff2/woff2-1.0.2-r6.ebuild
new file mode 100644
index 000000000000..f67dcb40e762
--- /dev/null
+++ b/media-libs/woff2/woff2-1.0.2-r6.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake
+
+DESCRIPTION="Encode/decode WOFF2 font format"
+HOMEPAGE="https://github.com/google/woff2"
+SRC_URI="https://github.com/google/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
+IUSE=""
+
+RDEPEND="app-arch/brotli:="
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-aliasing.patch
+ "${FILESDIR}"/${PN}-1.0.2-gcc15.patch
+)
+
+src_configure() {
+ local mycmakeargs=(
+ -DCMAKE_SKIP_RPATH=ON # needed, causes QA warnings otherwise
+ -DCANONICAL_PREFIXES=ON #661942
+ )
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+
+ dobin "${BUILD_DIR}"/woff2_compress
+ dobin "${BUILD_DIR}"/woff2_decompress
+ dobin "${BUILD_DIR}"/woff2_info
+
+ einstalldocs
+}