From 6a4c51171535057c592da573fd7d7f554499eb56 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 21 Jan 2019 19:40:05 -0500 Subject: [PATCH] Backport another patch to fix s390x. --- 1574.patch | 27 +++++++++++++++++++++++++++ zeromq.spec | 6 ++++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 1574.patch diff --git a/1574.patch b/1574.patch new file mode 100644 index 0000000..cbce755 --- /dev/null +++ b/1574.patch @@ -0,0 +1,27 @@ +From 25a50ca0d5d3ea076c63c23692e4cb9868bfb55d Mon Sep 17 00:00:00 2001 +From: KIU Shueng Chuan +Date: Tue, 8 Sep 2015 17:26:31 +0800 +Subject: [PATCH] avoid dereferencing uint32_t on unaligned address + +--- + src/socket_base.cpp | 21 +++++---------------- + 1 file changed, 5 insertions(+), 16 deletions(-) + +diff --git a/src/socket_base.cpp b/src/socket_base.cpp +index a980015fc..ea178a868 100644 +--- a/src/socket_base.cpp ++++ b/src/socket_base.cpp +@@ -1361,8 +1361,11 @@ void zmq::socket_base_t::monitor_event (int event_, int value_, const std::strin + zmq_msg_t msg; + zmq_msg_init_size (&msg, 6); + uint8_t *data = (uint8_t *) zmq_msg_data (&msg); +- *(uint16_t *) (data + 0) = (uint16_t) event_; +- *(uint32_t *) (data + 2) = (uint32_t) value_; ++ // Avoid dereferencing uint32_t on unaligned address ++ uint16_t event = (uint16_t) event_; ++ uint32_t value = (uint32_t) value_; ++ memcpy (data + 0, &event, sizeof(event)); ++ memcpy (data + 2, &value, sizeof(value)); + zmq_sendmsg (monitor_socket, &msg, ZMQ_SNDMORE); + + // Send address in second frame diff --git a/zeromq.spec b/zeromq.spec index 32f789c..a2ff707 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -11,6 +11,7 @@ Source0: https://github.com/zeromq/zeromq4-1/releases/download/v%{version Source1: https://raw.githubusercontent.com/zeromq/cppzmq/master/zmq.hpp Source2: https://raw.githubusercontent.com/zeromq/cppzmq/master/LICENSE Patch0001: https://github.com/zeromq/libzmq/pull/1260.patch +Patch0002: https://github.com/zeromq/libzmq/pull/1574.patch BuildRequires: autoconf BuildRequires: automake @@ -86,7 +87,8 @@ rm %{buildroot}%{_libdir}/libzmq.la %check -make check V=1 +make check V=1 || ( cat test-suite.log && exit 1 ) + %ldconfig_scriptlets @@ -110,7 +112,7 @@ make check V=1 %changelog * Mon Jan 21 2019 Elliott Sales de Andrade - 4.1.6-11 -- Backport patch to fix test failures in build +- Backport patches to fix test failures in build - Cleanup spec a little - Use explicit soname version in file list