Bug#750013: colord: FTBS on s390x: wrong cast from uint64_t * to uint32_t *

2014-06-01 Thread Christopher James Halse Rogers
Thanks for the patch! I'll commit this upstream and do a new upload 
soon.



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#750013: colord: FTBS on s390x: wrong cast from uint64_t * to uint32_t *

2014-05-31 Thread Aurelien Jarno
Package: colord
Version: 1.2.0-3
Severity: serious
Tags: upstream patch
Justification: fails to build from source (but built successfully in the past)

colord fails to buid from source on s390x due to changs introduced in the
recent version. From the build log:

| Making all in data
| make[3]: Entering directory '/«PKGBUILDDIR»/data'
| Making all in cmf
| make[4]: Entering directory '/«PKGBUILDDIR»/data/cmf'
| \
| ../../client/cd-it8 create-cmf CIE1931-2deg-XYZ.cmf   \
|   ./CIE1931-2deg-XYZ.csv 1.0
| 
| (lt-cd-it8:28566): GLib-ERROR **: 
/build/glib2.0-QixhbO/glib2.0-2.40.0/./glib/gmem.c:103: failed to allocate 
14804752269312 bytes
| make[4]: *** [CIE1931-2deg-XYZ.cmf] Trace/breakpoint trap
| Makefile:602: recipe for target 'CIE1931-2deg-XYZ.cmf' failed
| make[4]: Leaving directory '/«PKGBUILDDIR»/data/cmf'
| make[3]: *** [all-recursive] Error 1

The full build log is available at:
https://buildd.debian.org/status/fetch.php?pkg=colordarch=s390xver=1.2.0-3stamp=1401508205

The problem is due to a wrong cast in lib/colord/cd-it8.c:

|GDateTime *datetime = NULL;
|gsize size_tmp = 0;
|guint i;
...
|ret = cmsIT8SaveToMem (it8_lcms, NULL, (cmsUInt32Number *) size_tmp);
|g_assert (ret);
|data_tmp = g_malloc (size_tmp);
|ret = cmsIT8SaveToMem (it8_lcms, data_tmp, (cmsUInt32Number *) 
size_tmp);

size_tmp is equivalent to an uint64_t, while cmsUInt32Number is
equivalent to uint32_t. Such a cast is not allowed, and does not work
on 64-bit big endian machines.

The patch bellow fixes the issue:

--- a/lib/colord/cd-it8.c
+++ b/lib/colord/cd-it8.c
@@ -1424,7 +1424,7 @@ cd_it8_save_to_data (CdIt8 *it8,
gchar *data_tmp = NULL;
gchar *date_str = NULL;
GDateTime *datetime = NULL;
-   gsize size_tmp = 0;
+   cmsUInt32Number size_tmp = 0;
guint i;
 
g_return_val_if_fail (CD_IS_IT8 (it8), FALSE);
@@ -1494,10 +1494,10 @@ cd_it8_save_to_data (CdIt8 *it8,
}
 
/* write the file */
-   ret = cmsIT8SaveToMem (it8_lcms, NULL, (cmsUInt32Number *) size_tmp);
+   ret = cmsIT8SaveToMem (it8_lcms, NULL, size_tmp);
g_assert (ret);
data_tmp = g_malloc (size_tmp);
-   ret = cmsIT8SaveToMem (it8_lcms, data_tmp, (cmsUInt32Number *) 
size_tmp);
+   ret = cmsIT8SaveToMem (it8_lcms, data_tmp, size_tmp);
g_assert (ret);
 
/* save for caller */


-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental') 
Architecture: s390x

Kernel: Linux 3.2.0-4-s390x (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org