[packages/snappy] - updated to 1.3.1 + upstream fix for 32-bit archs

qboosh qboosh at pld-linux.org
Tue Nov 17 21:23:55 CET 2026


commit 1890f2da258e0d4a619197e045c06f1a1a20dde2
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Tue Nov 17 21:23:53 2026 +0100

    - updated to 1.3.1 + upstream fix for 32-bit archs

 snappy-32bit.patch | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 snappy.spec        | 16 ++++++++------
 2 files changed, 74 insertions(+), 7 deletions(-)
---
diff --git a/snappy.spec b/snappy.spec
index d520ea6..0e6d7dc 100644
--- a/snappy.spec
+++ b/snappy.spec
@@ -6,20 +6,21 @@
 Summary:	Snappy - fast compression/decompression library
 Summary(pl.UTF-8):	Snappy - biblioteka do szybkiej kompresji i dekompresji
 Name:		snappy
-Version:	1.2.2
-Release:	2
+Version:	1.3.1
+Release:	1
 License:	BSD
 Group:		Libraries
 #Source0Download: https://github.com/google/snappy/releases
 Source0:	https://github.com/google/snappy/archive/%{version}/%{name}-%{version}.tar.gz
-# Source0-md5:	30286dd6311dee1d5498c57f62eda7b8
+# Source0-md5:	33545fac0b61ee41658be166a24db4f1
 Source1:	%{name}.pc.in
 Patch0:		%{name}-gtest.patch
+Patch1:		%{name}-32bit.patch
 URL:		http://google.github.io/snappy/
 BuildRequires:	cmake >= 3.10
 BuildRequires:	libstdc++-devel >= 6:7
 BuildRequires:	pkgconfig
-BuildRequires:	rpmbuild(macros) >= 1.605
+BuildRequires:	rpmbuild(macros) >= 2.035
 %if %{with tests}
 BuildRequires:	gtest-devel
 BuildRequires:	lzo-devel >= 2
@@ -76,8 +77,8 @@ Snappy wcześniej (np. na różnych prezentacjach Google'a) był nazywany
 Summary:	Header files for Snappy library
 Summary(pl.UTF-8):	Pliki nagłówkowe biblioteki Snappy
 Group:		Development/Libraries
-Requires:	%{name} = %{version}-%{release}
-Requires:	libstdc++-devel
+Requires:	%{name}%{?_isa} = %{version}-%{release}
+Requires:	libstdc++-devel%{?_isa} >= 6:7
 
 %description devel
 Header files for Snappy library.
@@ -89,7 +90,7 @@ Pliki nagłówkowe biblioteki Snappy.
 Summary:	Static Snappy library
 Summary(pl.UTF-8):	Statyczna biblioteka Snappy
 Group:		Development/Libraries
-Requires:	%{name}-devel = %{version}-%{release}
+Requires:	%{name}-devel%{?_isa} = %{version}-%{release}
 
 %description static
 Static Snappy library.
@@ -100,6 +101,7 @@ Statyczna biblioteka Snappy.
 %prep
 %setup -q
 %patch -P0 -p1
+%patch -P1 -p1
 
 %build
 %if %{with static_libs}
diff --git a/snappy-32bit.patch b/snappy-32bit.patch
new file mode 100644
index 0000000..9a59537
--- /dev/null
+++ b/snappy-32bit.patch
@@ -0,0 +1,65 @@
+From f28c4206f32d02a4b6fc571c5a7053cae39f38f8 Mon Sep 17 00:00:00 2001
+From: jdymitarai <o10040115 at gmail.com>
+Date: Sun, 4 Oct 2026 10:01:09 +0900
+Subject: [PATCH] decompress: use uint64_t for literal_length to prevent 32-bit
+ overflow (fixes #266)
+
+In commit 7406111, size_t{1} was added to ExtractLowBytes(...) to prevent literal lengths of 2^32 from wrapping to 0. However, on 32-bit platforms (e.g., i386, armhf), sizeof(size_t) == 4, so 0xffffffff + size_t{1} still overflows to 0. This causes Snappy.LiteralLengthU32Overflow to fail on 32-bit systems because the poison literal is bypassed.
+
+Change literal_length to uint64_t and promote the addition with uint64_t{1} so that extended literal lengths are 64 bits across all architectures. Add static_cast<size_t> when passing length to TryFastAppend, Append, and pointer arithmetic to ensure clean compilation on 32-bit targets.
+---
+ snappy.cc | 21 +++++++++++++--------
+ 1 file changed, 13 insertions(+), 8 deletions(-)
+
+diff --git a/snappy.cc b/snappy.cc
+index add72f8..1298828 100644
+--- a/snappy.cc
++++ b/snappy.cc
+@@ -1691,10 +1691,11 @@ class SnappyDecompressor {
+       // pb              24%        76%
+       // bin             24%        76%
+       if (SNAPPY_PREDICT_FALSE((c & 0x3) == LITERAL)) {
+-        size_t literal_length = (c >> 2) + 1u;
+-        if (writer->TryFastAppend(ip, ip_limit_ - ip, literal_length, &op)) {
++        uint64_t literal_length = (c >> 2) + 1u;
++        if (writer->TryFastAppend(ip, ip_limit_ - ip,
++                                  static_cast<size_t>(literal_length), &op)) {
+           assert(literal_length < 61);
+-          ip += literal_length;
++          ip += static_cast<size_t>(literal_length);
+           // NOTE: There is no MAYBE_REFILL() here, as TryFastAppend()
+           // will not return true unless there's already at least five spare
+           // bytes in addition to the literal.
+@@ -1703,14 +1704,16 @@ class SnappyDecompressor {
+         }
+         if (SNAPPY_PREDICT_FALSE(literal_length >= 61)) {
+           // Long literal.
+-          const size_t literal_length_length = literal_length - 60;
++          const size_t literal_length_length =
++              static_cast<size_t>(literal_length - 60);
+           // NOTE: literal_length might be equal 2^32 (i.e. ExtractLowBytes
+           // returns 0xFFFFFFFF); this is implicitly invalid stream (since
+           // uncompressed length is capped with 0xFFFFFFFF); for performance we
+           // do not check for this case here.
+           literal_length =
+-              ExtractLowBytes(LittleEndian::Load32(ip), literal_length_length) +
+-              size_t{1};
++              static_cast<uint64_t>(ExtractLowBytes(LittleEndian::Load32(ip),
++                                                    literal_length_length)) +
++              uint64_t{1};
+           ip += literal_length_length;
+         }
+ 
+@@ -1727,8 +1730,10 @@ class SnappyDecompressor {
+           ip_limit_ = ip + avail;
+           ResetLimit(ip);
+         }
+-        if (!writer->Append(ip, literal_length, &op)) goto exit;
+-        ip += literal_length;
++        if (!writer->Append(ip, static_cast<size_t>(literal_length), &op)) {
++          goto exit;
++        }
++        ip += static_cast<size_t>(literal_length);
+         MAYBE_REFILL();
+       } else {
+         if (SNAPPY_PREDICT_FALSE((c & 3) == COPY_4_BYTE_OFFSET)) {
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/snappy.git/commitdiff/1890f2da258e0d4a619197e045c06f1a1a20dde2



More information about the pld-cvs-commit mailing list