[med-svn] [Git][med-team/libkff][master] 2 commits: Fix 8-byte big-endian stores on 32-bit architectures, fixing the autopkgtest on i386

Andreas Tille (@tille) gitlab at salsa.debian.org
Tue Nov 10 16:16:48 GMT 2026



Andreas Tille pushed to branch master at Debian Med / libkff


Commits:
bcedb7fa by Andreas Tille at 2026-11-10T16:57:46+01:00
Fix 8-byte big-endian stores on 32-bit architectures, fixing the autopkgtest on i386

- - - - -
256856c0 by Andreas Tille at 2026-11-10T16:59:12+01:00
Upload to unstable

- - - - -


3 changed files:

- debian/changelog
- + debian/patches/fix-32bit-store-big-endian.patch
- debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+libkff (0.0~git20250321.cf4d866-3) unstable; urgency=medium
+
+  * Fix 8-byte big-endian stores on 32-bit architectures, fixing the
+    autopkgtest on i386
+
+ -- Andreas Tille <tille at debian.org>  Tue, 10 Nov 2026 16:57:49 +0100
+
 libkff (0.0~git20250321.cf4d866-2) unstable; urgency=medium
 
   * Build static and shared libraries


=====================================
debian/patches/fix-32bit-store-big-endian.patch
=====================================
@@ -0,0 +1,27 @@
+Description: Fix 8-byte big-endian stores on 32-bit platforms
+ store_big_endian() shifts its argument right by up to 56 bits. When the
+ argument is a 32-bit value (e.g. std::map::size() returns size_t, which is
+ 32 bits on i386), that shift is undefined behaviour and GCC on i386 masks the
+ shift count modulo 32, so a value of 2 is written as 00 00 00 02 00 00 00 02.
+ This corrupts the index section: the reader then finds the section header in
+ the wrong place and throws std::out_of_range while looking for the trailing
+ signature at the end of the file, failing the autopkgtest on i386.
+ Widening the argument to uint64_t before shifting makes the store correct for
+ any input type.
+Author: Andreas Tille <tille at debian.org>
+Last-Update: 2026-11-10
+Assisted-By: aim2balance/a2b-code
+
+--- a/kff_io.cpp
++++ b/kff_io.cpp
+@@ -18,8 +18,9 @@
+ 
+ template<typename T>
+ void store_big_endian(uint8_t * buff, size_t size, const T& data) {
++	uint64_t value = data;
+ 	for (int b = size - 1; b >= 0; --b) {
+-		*buff++ = data >> (8 * b);
++		*buff++ = value >> (8 * b);
+ 	}
+ }
+ 


=====================================
debian/patches/series
=====================================
@@ -1,2 +1,3 @@
 add-install-rules.patch
 build-static-and-shared-library.patch
+fix-32bit-store-big-endian.patch



View it on GitLab: https://salsa.debian.org/med-team/libkff/-/compare/ca5964a7d9872f6d58535eb451f6ce8140cd0656...256856c0af241376433c20f5a0e6096d1c62fdcb

-- 
View it on GitLab: https://salsa.debian.org/med-team/libkff/-/compare/ca5964a7d9872f6d58535eb451f6ce8140cd0656...256856c0af241376433c20f5a0e6096d1c62fdcb
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20261110/2a77c68e/attachment-0001.htm>


More information about the debian-med-commit mailing list