[pkg-fso-maint] Bug#648447: fso-gsmd: function return values implicitly converted to pointers, unreliable on amd64

Colin Watson cjwatson at ubuntu.com
Fri Nov 11 15:44:06 UTC 2011

Package: fso-gsmd
Version: 0.5.0+git20110916-1
Severity: important
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch precise

There are some missing prototypes in fso-gsmd for functions returning
pointers.  This causes GCC to assume a prototype returning int, which
can cause problems on architectures such as amd64 where the sizes of int
and pointer aren't equal, because it ends up throwing away the top half
of the pointer.  On Ubuntu amd64 we force this to cause a build failure
because it can produce runtime errors that are otherwise hard to track


The following patch syncs up the prototypes in conversions.h with the
definitions in conversions.c to fix this bug.

  * Add some missing prototypes to src/3rdparty/conversions.h.

diff -Nru fso-gsmd-0.5.0+git20110916/debian/patches/missing-prototypes.patch fso-gsmd-0.5.0+git20110916/debian/patches/missing-prototypes.patch
--- fso-gsmd-0.5.0+git20110916/debian/patches/missing-prototypes.patch	1970-01-01 01:00:00.000000000 +0100
+++ fso-gsmd-0.5.0+git20110916/debian/patches/missing-prototypes.patch	2011-11-11 15:32:20.000000000 +0000
@@ -0,0 +1,27 @@
+Description: Add some necessary prototypes to conversions.h
+Author: Colin Watson <cjwatson at ubuntu.com>
+Forwarded: no
+Last-Update: 2011-11-11
+Index: b/src/3rdparty/conversions.h
+--- a/src/3rdparty/conversions.h
++++ b/src/3rdparty/conversions.h
+@@ -1,12 +1,17 @@
++char *utf8_to_ucs2(const char* str);
++char *utf8_to_gsm(const char* str);
+ char *gsm_to_utf8(const char* str);
+ char *ucs2_to_utf8(const char *str);
+ typedef struct sms structsms;
++void sms_copy(void* self, void* dup);
+ struct sms* sms_new();
+ void sms_free(struct sms* self);
+ long sms_size();
++struct cbs* cbs_new();
++void cbs_free(struct cb* self);
+ #endif /* CONVERSIONS_H */
diff -Nru fso-gsmd-0.5.0+git20110916/debian/patches/series fso-gsmd-0.5.0+git20110916/debian/patches/series
--- fso-gsmd-0.5.0+git20110916/debian/patches/series	2011-10-30 16:52:10.000000000 +0000
+++ fso-gsmd-0.5.0+git20110916/debian/patches/series	2011-11-11 15:27:13.000000000 +0000
@@ -4,3 +4,4 @@


Colin Watson                                       [cjwatson at ubuntu.com]

More information about the pkg-fso-maint mailing list