[corosync/f16] Add fix for crash on i686

Fabio M. Di Nitto fabbione at fedoraproject.org
Wed Oct 10 07:39:37 UTC 2012


commit 5f12dfc0b400dcd392ff3aa448c76c6a1e0e2654
Author: Fabio M. Di Nitto <fdinitto at redhat.com>
Date:   Wed Oct 10 09:39:21 2012 +0200

    Add fix for crash on i686
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>

 corosync.spec                                |    7 ++++-
 fix_crash_due_to_incorrect_malloc_size.patch |   35 ++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/corosync.spec b/corosync.spec
index d5ce580..e366085 100644
--- a/corosync.spec
+++ b/corosync.spec
@@ -14,11 +14,12 @@
 Name: corosync
 Summary: The Corosync Cluster Engine and Application Programming Interfaces
 Version: 1.4.4
-Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}
+Release: 2%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}
 License: BSD
 Group: System Environment/Base
 URL: http://ftp.corosync.org
 Source0: ftp://ftp:user@ftp.corosync.org/downloads/%{name}-%{version}/%{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}.tar.gz
+Patch0: fix_crash_due_to_incorrect_malloc_size.patch
 
 # Runtime bits
 Requires: corosynclib = %{version}-%{release}
@@ -50,6 +51,7 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
 %prep
 %setup -q -n %{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}
+%patch0 -p1
 
 %build
 %if %{buildtrunk}
@@ -277,6 +279,9 @@ The Corosync Cluster Engine APIs.
 %{_mandir}/man8/sam_overview.8*
 
 %changelog
+* Wed Oct 10 2012 Fabio M. Di Nitto <fdinitto at redhat.com> - 1.4.4-2
+- Add fix for crash on i686
+
 * Tue Aug 14 2012 Jan Friesse <jfriesse at redhat.com> - 1.4.4-1
 - New upstream release
 
diff --git a/fix_crash_due_to_incorrect_malloc_size.patch b/fix_crash_due_to_incorrect_malloc_size.patch
new file mode 100644
index 0000000..a8a5350
--- /dev/null
+++ b/fix_crash_due_to_incorrect_malloc_size.patch
@@ -0,0 +1,35 @@
+commit 0a85b888b0384e83fa4a80c3751a23f4de8a9310
+Author: Fabio M. Di Nitto <fdinitto at redhat.com>
+Date:   Tue Aug 21 10:49:20 2012 +0000
+
+    sa-confdb: fix crash due to incorrect malloc size
+    
+    with recent changes, confdb and saconfdb were allocating two different
+    sizes for the same results. While on x86_64 this was masked nicely,
+    on i686 it causes crashes.
+    
+    Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>
+    Reviewed-by: Jan Friesse <jfriesse at redhat.com>
+
+diff --git a/lib/sa-confdb.c b/lib/sa-confdb.c
+index 9a11418..7a8fabf 100644
+--- a/lib/sa-confdb.c
++++ b/lib/sa-confdb.c
+@@ -263,7 +263,7 @@ int confdb_sa_key_get_typed (
+ 				    &kvalue, value_len, (objdb_value_types_t*)type);
+ 	if (!res) {
+ 		if (!*value) {
+-			*value = malloc(*value_len);
++			*value = malloc(*value_len + 1);
+ 			if (!*value) {
+ 				res = CS_ERR_NO_MEMORY;
+ 			}
+@@ -443,7 +443,7 @@ int confdb_sa_key_iter_typed (
+ 		memcpy(key_name, kname, key_name_len);
+ 		key_name[key_name_len] = '\0';
+ 		if (!*value) {
+-			*value = malloc(*value_len);
++			*value = malloc(*value_len + 1);
+ 			if (!*value) {
+ 				res = CS_ERR_NO_MEMORY;
+ 			}


More information about the scm-commits mailing list