Package: libsnappy1v5
Version: 1.2.2-1
Followup-For: Bug #1149484

Dear Maintainer,

I've built the package from the 1.3.1-3 sources, adding
the patch from https://github.com/google/snappy/pull/269/changes

It seems to pass the internal build tests, and the reproducer
from the previous message is also giving reasonable output.

Please consider releasing a version with this patch added.
I am attaching the patch file to make it easy, please
let me know if there's anything else I can do to help.

-- System Information:
Debian Release: forky/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 7.2.8+deb14-amd64 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=en_IL.UTF-8, LC_CTYPE=en_IL.UTF-8 (charmap=UTF-8),
LANGUAGE=en_US Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libsnappy1v5 depends on:
ii  libc6       2.43-7
ii  libstdc++6  16.2.0-3

libsnappy1v5 recommends no packages.

libsnappy1v5 suggests no packages.

-- no debconf information

This is supposed to fix the package 

Bug-Debian: https://bugs.debian.org/1148501
Forwarded: no
---



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)) {

Reply via email to