Dear release team,

please consider the attached diff for libmms in stable. It fixes an alignment issue that makes the whole library rather useless on e.g. ARM.


 - Fabian
diff --git a/debian/changelog b/debian/changelog
index b9dd39c..da2c233 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+libmms (0.6-1squeeze1) stable; urgency=low
+
+  * Apply patch by Paul Burton cherry-picked from upstream git to fix
+    alignment issues on ARM (Closes: #611791).
+
+ -- Fabian Greffrath <fabian+deb...@greffrath.com>  Thu, 03 Feb 2011 10:47:49 +0100
+
 libmms (0.6-1) unstable; urgency=low
 
   * Imported Upstream version 0.6
diff --git a/debian/patches/0001-Endianness-macros-should-not-dereference-unaligned-p.patch b/debian/patches/0001-Endianness-macros-should-not-dereference-unaligned-p.patch
new file mode 100644
index 0000000..98c1e8a
--- /dev/null
+++ b/debian/patches/0001-Endianness-macros-should-not-dereference-unaligned-p.patch
@@ -0,0 +1,80 @@
+From 160a0c1c29b2be301a409856c4393dc9c1b88dd0 Mon Sep 17 00:00:00 2001
+From: Paul Burton <paul.bur...@imgtec.com>
+Date: Fri, 17 Sep 2010 14:08:57 +0100
+Subject: [PATCH] Endianness macros should not dereference unaligned pointers
+
+The LE_*/BE_* macros previously worked by casting the pointer passed to them to a pointer to the correct integer type, then dereferencing it. This will not work on architectures which don't allow unaligned data access. Instead, access one byte at a time and shift to form the value.
+---
+ src/bswap.h |   59 +++++++++++++++++++++++++++++++++++++++++++----------------
+ 1 files changed, 43 insertions(+), 16 deletions(-)
+
+--- libmms.orig/src/bswap.h
++++ libmms/src/bswap.h
+@@ -21,23 +21,50 @@
+  */
+ 
+ 
+-/* Go cheap now, will rip out glib later. *Sigh* */
+-#include <glib.h>
++#include <stdint.h>
+ 
+-/* NOTE:
+- * Now, to clear up confusion: LE_XX means "from LE to native, XX bits wide"
+- * I know it's not very clear naming (tell me about it, I
+- * misinterpreted in first version and caused bad nasty bug, *sigh*),
+- * but that's inherited code, will clean up as things go
+- * Oh, and one more thing -- they take *pointers*, not actual ints
+- */
+-
+-#define LE_16(val) (GINT16_FROM_LE (*((u_int16_t*)(val))))
+-#define BE_16(val) (GINT16_FROM_BE (*((u_int16_t*)(val))))
+-#define LE_32(val) (GINT32_FROM_LE (*((u_int32_t*)(val))))
+-#define BE_32(val) (GINT32_FROM_BE (*((u_int32_t*)(val))))
+-
+-#define LE_64(val) (GINT64_FROM_LE (*((u_int64_t*)(val))))
+-#define BE_64(val) (GINT64_FROM_BE (*((u_int64_t*)(val))))
++#define SWAP_ENDIAN_16(val) \
++	(val[1] | (val[0] << 8))
++#define SWAP_ENDIAN_32(val) \
++	(val[3] | (val[2] << 8) | (val[1] << 16) | (val[0] << 24))
++#define SWAP_ENDIAN_64(val) \
++	(val[7] | (val[6] << 8) | (val[5] << 16) | (val[4] << 24) | \
++	((uint64_t)val[3] << 32) | ((uint64_t)val[2] << 40) | \
++	((uint64_t)val[1] << 48) | ((uint64_t)val[0] << 56))
++
++#define SAME_ENDIAN_16(val) \
++	(val[0] | (val[1] << 8))
++#define SAME_ENDIAN_32(val) \
++	(val[0] | (val[1] << 8) | (val[2] << 16) | (val[3] << 24))
++#define SAME_ENDIAN_64(val) \
++	(val[0] | (val[1] << 8) | (val[2] << 16) | (val[3] << 24) | \
++	((uint64_t)val[4] << 32) | ((uint64_t)val[5] << 40) | \
++	((uint64_t)val[6] << 48) | ((uint64_t)val[7] << 56))
++
++#ifndef WORDS_BIGENDIAN
++
++/* Little endian */
++
++#define LE_16(val) SAME_ENDIAN_16(((uint8_t *)(val)))
++#define LE_32(val) SAME_ENDIAN_32(((uint8_t *)(val)))
++#define LE_64(val) SAME_ENDIAN_64(((uint8_t *)(val)))
++#define BE_16(val) SWAP_ENDIAN_16(((uint8_t *)(val)))
++#define BE_32(val) SWAP_ENDIAN_32(((uint8_t *)(val)))
++#define BE_64(val) SWAP_ENDIAN_64(((uint8_t *)(val)))
++
++#elif WORDS_BIGENDIAN == 1
++
++/* Big endian */
++
++#define LE_16(val) SWAP_ENDIAN_16(((uint8_t *)(val)))
++#define LE_32(val) SWAP_ENDIAN_32(((uint8_t *)(val)))
++#define LE_64(val) SWAP_ENDIAN_64(((uint8_t *)(val)))
++#define BE_16(val) SAME_ENDIAN_16(((uint8_t *)(val)))
++#define BE_32(val) SAME_ENDIAN_32(((uint8_t *)(val)))
++#define BE_64(val) SAME_ENDIAN_64(((uint8_t *)(val)))
++
++#else
++#error Unknown endianness!
++#endif
+ 
+ #endif /* BSWAP_H_INCLUDED */
diff --git a/debian/patches/series b/debian/patches/series
index 897fe03..f086ba3 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 0001-Remove-unneeded-bswap.h-from-public-headers.patch
 0003-Bug-493735-libmms-dev-Incorrect-use-of-this-keyword-.patch
+0001-Endianness-macros-should-not-dereference-unaligned-p.patch
_______________________________________________
pkg-multimedia-maintainers mailing list
pkg-multimedia-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/pkg-multimedia-maintainers

Reply via email to