Package: qatzip
Followup-For: Bug #1139485
User: [email protected]
Usertags: origin-ubuntu stonking ubuntu-patch
Control: tags -1 patch ftbfs

Dear Maintainer,

This is the fix for this FTBFS issue.
The patch has been sent upstream at: https://github.com/intel/QATzip/pull/152

  * d/p/fix-Werror-alloc-size-larger-than-in-metrixReset.patch: Fix
    build error because of allocation size out of range
    (Closes: #1139485).


Thanks for considering the patch.


-- System Information:
Debian Release: trixie/sid
  APT prefers noble-updates
  APT policy: (500, 'noble-updates'), (500, 'noble-security'), (500, 'noble'), 
(100, 'noble-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 7.0.0-28-generic (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru 
qatzip-1.3.2/debian/patches/fix-Werror-alloc-size-larger-than-in-metrixReset.patch
 
qatzip-1.3.2/debian/patches/fix-Werror-alloc-size-larger-than-in-metrixReset.patch
--- 
qatzip-1.3.2/debian/patches/fix-Werror-alloc-size-larger-than-in-metrixReset.patch
  1970-01-01 01:00:00.000000000 +0100
+++ 
qatzip-1.3.2/debian/patches/fix-Werror-alloc-size-larger-than-in-metrixReset.patch
  2026-08-11 01:27:30.000000000 +0200
@@ -0,0 +1,35 @@
+Description: Fix -Werror=alloc-size-larger-than in metrixReset
+
+LSM_MET_DEPTH was defined as (1 << lsm_met_len_shift), where the
+literal 1 is a signed int and lsm_met_len_shift is a runtime global.
+Recent GCC assumes the shift may yield a negative int (e.g. 1 << 31), which
+sign-extends to a huge size_t when passed to calloc(), triggering
+-Werror=alloc-size-larger-than and failing the build.
+
+Cast the literal to size_t so the shift is done in unsigned 64-bit
+arithmetic, keeping the calloc size argument within a valid range.
+
+Author: Hector Cao <[email protected]>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1139485
+Forwarded: https://github.com/intel/QATzip/pull/152
+
+---
+ src/qatzip_internal.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/qatzip_internal.h b/src/qatzip_internal.h
+index 173df22..154c7ad 100755
+--- a/src/qatzip_internal.h
++++ b/src/qatzip_internal.h
+@@ -304,7 +304,7 @@ typedef struct QzSessionParamsInternal_S {
+ } QzSessionParamsInternal_T;
+ 
+ /* lsm_met_len_shift is global variable */
+-#define LSM_MET_DEPTH (1<<(lsm_met_len_shift))
++#define LSM_MET_DEPTH ((size_t)1<<(lsm_met_len_shift))
+ 
+ typedef struct LatencyMetrix_S {
+     unsigned long *latency_array;
+-- 
+2.43.0
+
diff -Nru qatzip-1.3.2/debian/patches/series qatzip-1.3.2/debian/patches/series
--- qatzip-1.3.2/debian/patches/series  2026-02-19 15:25:56.000000000 +0100
+++ qatzip-1.3.2/debian/patches/series  2026-08-11 01:28:03.000000000 +0200
@@ -1 +1,2 @@
 debian/0001-fortify-source.patch
+fix-Werror-alloc-size-larger-than-in-metrixReset.patch

Reply via email to