aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2015-11-26 08:41:55 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2015-11-26 08:41:55 +0000
commit1ba7e3811be65723b76cb8f395ba47665e67d88b (patch)
treef3e4a02ba3577ec70980406dc064eb55881f7d22
parent20bbc8662263c3c14034bb07cef31bdbd3a5d858 (diff)
fix for sigbus on ARM caused by unaligned access (#242).
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3486 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog7
-rw-r--r--libsylph/procmsg.c6
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index e7469899..3c02adfc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-11-26
+
+ * libsylph/procmsg.c:
+ procmsg_read_cache_data_str_mem()
+ READ_CACHE_DATA_INT(): fix for sigbus on ARM caused by unaligned access
+ (#242).
+
2015-10-27
* src/prefs_filter_edit.c: prefs_filter_edit_open():
diff --git a/libsylph/procmsg.c b/libsylph/procmsg.c
index fe65395a..28d16f32 100644
--- a/libsylph/procmsg.c
+++ b/libsylph/procmsg.c
@@ -164,7 +164,7 @@ static gint procmsg_read_cache_data_str_mem(const gchar **p, const gchar *endp,
if (endp - *p < sizeof(len))
return -1;
- len = *(const guint32 *)(*p);
+ memcpy(&len, *p, sizeof(len));
*p += sizeof(len);
if (len > G_MAXINT || len > endp - *p)
return -1;
@@ -197,7 +197,9 @@ static gint procmsg_read_cache_data_str_mem(const gchar **p, const gchar *endp,
g_mapped_file_free(mapfile); \
return NULL; \
} else { \
- n = *(const guint32 *)p; \
+ guint32 idata; \
+ memcpy(&idata, p, sizeof(idata)); \
+ n = idata; \
p += sizeof(guint32); \
} \
}