diff --git a/gsoap-01-sharedlibs.diff b/gsoap-01-sharedlibs.diff index b757f39..737bedd 100644 --- a/gsoap-01-sharedlibs.diff +++ b/gsoap-01-sharedlibs.diff @@ -77,7 +77,7 @@ Index: gsoap-2.8.21/gsoap/Makefile.am -libgsoapssl___a_CXXFLAGS = $(SOAPCPP2_DEBUG) $(SOAPCPP2_NONAMESPACES) $(SOAPCPP2_IPV6) -D$(platform) $(WSDL2H_EXTRA_FLAGS) -DWITH_DOM +libgsoap_la_SOURCES = stdsoap2.c dom.c +libgsoap_la_CFLAGS = $(SOAPCPP2_DEBUG) $(SOAPCPP2_NONAMESPACES) $(SOAPCPP2_IPV6) -D$(platform) -+libgsoap_la_LDFLAGS = -release ${PACKAGE_VERSION} -version-info 0:0:0 ++libgsoap_la_LDFLAGS = -release ${PACKAGE_VERSION} +libgsoap___la_SOURCES = stdsoap2_cpp.cpp dom_cpp.cpp +libgsoap___la_CXXFLAGS = $(SOAPCPP2_DEBUG) $(SOAPCPP2_NONAMESPACES) $(SOAPCPP2_IPV6) -D$(platform) +libgsoap___la_LDFLAGS = ${libgsoap_la_LDFLAGS} diff --git a/gsoap-02-typepuns.diff b/gsoap-02-typepuns.diff index 92964b3..ebb509a 100644 --- a/gsoap-02-typepuns.diff +++ b/gsoap-02-typepuns.diff @@ -1,31 +1,86 @@ -From: Jan Engelhardt -Date: 2011-07-01 17:19:00 +0200 +References: https://sourceforge.net/p/gsoap2/patches/124/attachment/gsoap-aliasing.patch -src: fix invocation of undefined behavior - -The int type may have a stricter alignment than buf, and as such, -using *(int *)buf is prone to undefined behavior, usually manifesting -themselves in SIGBUS. - ---- - gsoap/stdsoap2.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -Index: gsoap-2.8.21/gsoap/stdsoap2.c -=================================================================== ---- gsoap-2.8.21.orig/gsoap/stdsoap2.c -+++ gsoap-2.8.21/gsoap/stdsoap2.c -@@ -3073,10 +3073,12 @@ int +diff -ur gsoap-2.8.orig/gsoap/plugin/wsaapi.c gsoap-2.8/gsoap/plugin/wsaapi.c +--- gsoap-2.8.orig/gsoap/plugin/wsaapi.c 2015-04-14 08:46:30.000000000 +0200 ++++ gsoap-2.8/gsoap/plugin/wsaapi.c 2015-05-05 09:19:27.985619710 +0200 +@@ -599,7 +599,7 @@ + k += 0x7FFFFFFF; + r2 = k; + k &= 0x8FFFFFFF; +- r2 += *(int*)soap->buf; ++ r2 += soap->buf[0] << 24 + soap->buf[1] << 16 + soap->buf[2] << 8 + soap->buf[3]; + #endif + r3 = soap_random; + r4 = soap_random; +diff -ur gsoap-2.8.orig/gsoap/samples/calc_vs2005/calc_vs2005/stdsoap2.cpp gsoap-2.8/gsoap/samples/calc_vs2005/calc_vs2005/stdsoap2.cpp +--- gsoap-2.8.orig/gsoap/samples/calc_vs2005/calc_vs2005/stdsoap2.cpp 2015-04-14 08:46:34.000000000 +0200 ++++ gsoap-2.8/gsoap/samples/calc_vs2005/calc_vs2005/stdsoap2.cpp 2015-05-05 09:01:31.633153838 +0200 +@@ -3105,11 +3105,11 @@ + int SOAP_FMAC2 soap_rand() - { unsigned char buf[4]; -+ int r; +-{ unsigned char buf[4]; ++{ int buf; if (!soap_ssl_init_done) soap_ssl_init(); - RAND_pseudo_bytes(buf, 4); +- RAND_pseudo_bytes(buf, 4); - return *(int*)buf; -+ memcpy(&r, buf, sizeof(r)); -+ return r; ++ RAND_pseudo_bytes((unsigned char*)&buf, sizeof(int)); ++ return buf; + } + #endif + #endif +diff -ur gsoap-2.8.orig/gsoap/stdsoap2.c gsoap-2.8/gsoap/stdsoap2.c +--- gsoap-2.8.orig/gsoap/stdsoap2.c 2015-04-14 08:46:36.000000000 +0200 ++++ gsoap-2.8/gsoap/stdsoap2.c 2015-05-05 09:01:31.633153838 +0200 +@@ -3105,11 +3105,11 @@ + int + SOAP_FMAC2 + soap_rand() +-{ unsigned char buf[4]; ++{ int buf; + if (!soap_ssl_init_done) + soap_ssl_init(); +- RAND_pseudo_bytes(buf, 4); +- return *(int*)buf; ++ RAND_pseudo_bytes((unsigned char*)&buf, sizeof(int)); ++ return buf; + } + #endif + #endif +diff -ur gsoap-2.8.orig/gsoap/stdsoap2.cpp gsoap-2.8/gsoap/stdsoap2.cpp +--- gsoap-2.8.orig/gsoap/stdsoap2.cpp 2015-04-14 08:46:36.000000000 +0200 ++++ gsoap-2.8/gsoap/stdsoap2.cpp 2015-05-05 09:01:31.633153838 +0200 +@@ -3105,11 +3105,11 @@ + int + SOAP_FMAC2 + soap_rand() +-{ unsigned char buf[4]; ++{ int buf; + if (!soap_ssl_init_done) + soap_ssl_init(); +- RAND_pseudo_bytes(buf, 4); +- return *(int*)buf; ++ RAND_pseudo_bytes((unsigned char*)&buf, sizeof(int)); ++ return buf; + } + #endif + #endif +diff -ur gsoap-2.8.orig/gsoap/VisualStudio2005/wsdl2h/wsdl2h/stdsoap2.cpp gsoap-2.8/gsoap/VisualStudio2005/wsdl2h/wsdl2h/stdsoap2.cpp +--- gsoap-2.8.orig/gsoap/VisualStudio2005/wsdl2h/wsdl2h/stdsoap2.cpp 2015-04-14 08:46:36.000000000 +0200 ++++ gsoap-2.8/gsoap/VisualStudio2005/wsdl2h/wsdl2h/stdsoap2.cpp 2015-05-05 09:01:31.633153838 +0200 +@@ -3105,11 +3105,11 @@ + int + SOAP_FMAC2 + soap_rand() +-{ unsigned char buf[4]; ++{ int buf; + if (!soap_ssl_init_done) + soap_ssl_init(); +- RAND_pseudo_bytes(buf, 4); +- return *(int*)buf; ++ RAND_pseudo_bytes((unsigned char*)&buf, sizeof(int)); ++ return buf; } #endif #endif diff --git a/gsoap-allocator.diff b/gsoap-allocator.diff new file mode 100644 index 0000000..39560d8 --- /dev/null +++ b/gsoap-allocator.diff @@ -0,0 +1,39 @@ +--- + gsoap/stdsoap2.cpp | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +Index: gsoap-2.8.22/gsoap/stdsoap2.cpp +=================================================================== +--- gsoap-2.8.22.orig/gsoap/stdsoap2.cpp ++++ gsoap-2.8.22/gsoap/stdsoap2.cpp +@@ -7256,7 +7256,13 @@ SOAP_FMAC1 + struct soap* + SOAP_FMAC2 + soap_versioning(soap_new)(soap_mode imode, soap_mode omode) +-{ struct soap *soap = (struct soap*)malloc(sizeof(struct soap)); ++{ ++#ifdef __cplusplus ++ struct soap *soap = new struct soap; ++#else ++ struct soap *soap = malloc(sizeof(struct soap)); ++ soap->dummy = NULL; ++#endif + if (soap) + soap_versioning(soap_init)(soap, imode, omode); + return soap; +@@ -8983,7 +8989,14 @@ SOAP_FMAC1 + struct soap* + SOAP_FMAC2 + soap_copy(const struct soap *soap) +-{ return soap_copy_context((struct soap*)malloc(sizeof(struct soap)), soap); ++{ ++#ifdef __cplusplus ++ return soap_copy_context(new struct soap, soap); ++#else ++ struct soap *s = malloc(sizeof(struct soap)); ++ s->dummy = NULL; ++ return soap_copy_context(s, soap); ++#endif + } + #endif + diff --git a/gsoap.changes b/gsoap.changes index 10ffeb6..5da39ee 100644 --- a/gsoap.changes +++ b/gsoap.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Tue Jun 2 11:19:46 UTC 2015 - jengelh@inai.de + +- Replace gsoap-02-typepuns.diff with better version from SF +- Add gsoap-allocator.diff to please UBSAN + +------------------------------------------------------------------- +Thu May 28 17:31:39 UTC 2015 - jengelh@inai.de + +- Drop unnecessary -version-info argument from _LDFLAGS variable + in gsoap-01-sharedlibs.diff (we have -release) + ------------------------------------------------------------------- Thu Apr 23 11:45:28 UTC 2015 - jengelh@inai.de diff --git a/gsoap.spec b/gsoap.spec index 986a3ed..2382515 100644 --- a/gsoap.spec +++ b/gsoap.spec @@ -17,7 +17,7 @@ Name: gsoap -%define lname libgsoap-2_8-0 +%define lname libgsoap-2_8 Version: 2.8.22 Release: 0 Summary: Toolkit for C/C++ server and client web service applications @@ -32,6 +32,7 @@ Patch13: gsoap-automake1_13.diff Patch1: gsoap-01-sharedlibs.diff Patch2: gsoap-02-typepuns.diff Patch3: gsoap-mindeflateratio.diff +Patch4: gsoap-allocator.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: autoconf BuildRequires: automake @@ -92,7 +93,7 @@ symlinks for libgsoap. %prep %setup -q cmp gsoap/stdsoap2.cpp gsoap/stdsoap2.c -%patch -P 13 -P 1 -P 2 -P 3 -p1 +%patch -P 13 -P 1 -P 2 -P 3 -P 4 -p1 cp gsoap/stdsoap2.cpp gsoap/stdsoap2.c %build @@ -125,12 +126,17 @@ rm -f "$b/%_libdir"/*.la; %files -n %lname %defattr(-,root,root) -%_libdir/*-2.8.so.* +%_libdir/*-2.8.so %files -n libgsoap-devel %defattr(-,root,root) %_includedir/* -%_libdir/*.so +%_libdir/libgsoap.so +%_libdir/libgsoapck.so +%_libdir/libgsoapssl.so +%_libdir/libgsoap++.so +%_libdir/libgsoapck++.so +%_libdir/libgsoapssl++.so %_libdir/pkgconfig/* %changelog