[sofia-sip] Add patch to fix compiler error. (#981056)

Brian Pepple bpepple at fedoraproject.org
Thu Dec 5 23:39:10 UTC 2013


commit 90527a2d9646f49d467b0dd71df884a7afa240b8
Author: Brian Pepple <bpepple at fedoraproject.org>
Date:   Thu Dec 5 18:38:53 2013 -0500

    Add patch to fix compiler error. (#981056)

 0001-fix-undefined-behaviour.patch |   51 ++++++++++++++++++++++++++++++++++++
 sofia-sip.spec                     |    8 +++++-
 2 files changed, 58 insertions(+), 1 deletions(-)
---
diff --git a/0001-fix-undefined-behaviour.patch b/0001-fix-undefined-behaviour.patch
new file mode 100644
index 0000000..95cf3fc
--- /dev/null
+++ b/0001-fix-undefined-behaviour.patch
@@ -0,0 +1,51 @@
+From 9a12b2f75cd3b9e5d65a5c1adecc9af8f0afb3dc Mon Sep 17 00:00:00 2001
+From: Radist Morse <>
+Date: Thu, 5 Dec 2013 20:05:52 +0000
+Subject: [PATCH] fix undefined behaviour
+
+There is a hacky loop through the members of the struct, which won't
+work if the compiler inserts a padding between them.
+---
+ libsofia-sip-ua/msg/msg_parser.c | 19 ++++++++++++++-----
+ 1 file changed, 14 insertions(+), 5 deletions(-)
+
+diff --git a/libsofia-sip-ua/msg/msg_parser.c b/libsofia-sip-ua/msg/msg_parser.c
+index 75954f8..c0bccab 100644
+--- a/libsofia-sip-ua/msg/msg_parser.c
++++ b/libsofia-sip-ua/msg/msg_parser.c
+@@ -2468,8 +2468,6 @@ int msg_header_prepend(msg_t *msg,
+ msg_header_t **
+ msg_hclass_offset(msg_mclass_t const *mc, msg_pub_t const *mo, msg_hclass_t *hc)
+ {
+-  int i;
+-
+   assert(mc && hc);
+ 
+   if (mc == NULL || hc == NULL)
+@@ -2484,9 +2482,20 @@ msg_hclass_offset(msg_mclass_t const *mc, msg_pub_t const *mo, msg_hclass_t *hc)
+   }
+   else
+     /* Header has no name. */
+-    for (i = 0; i <= 6; i++)
+-      if (hc->hc_hash == mc->mc_request[i].hr_class->hc_hash)
+-	return (msg_header_t **)((char *)mo + mc->mc_request[i].hr_offset);
++    if      (hc->hc_hash == mc->mc_request[0].hr_class->hc_hash)
++       return (msg_header_t **)((char *)mo + mc->mc_request[0].hr_offset);
++    else if (hc->hc_hash == mc->mc_status[0].hr_class->hc_hash)
++       return (msg_header_t **)((char *)mo + mc->mc_status[0].hr_offset);
++    else if (hc->hc_hash == mc->mc_separator[0].hr_class->hc_hash)
++       return (msg_header_t **)((char *)mo + mc->mc_separator[0].hr_offset);
++    else if (hc->hc_hash == mc->mc_payload[0].hr_class->hc_hash)
++       return (msg_header_t **)((char *)mo + mc->mc_payload[0].hr_offset);
++    else if (hc->hc_hash == mc->mc_unknown[0].hr_class->hc_hash)
++       return (msg_header_t **)((char *)mo + mc->mc_unknown[0].hr_offset);
++    else if (hc->hc_hash == mc->mc_error[0].hr_class->hc_hash)
++       return (msg_header_t **)((char *)mo + mc->mc_error[0].hr_offset);
++    else if (hc->hc_hash == mc->mc_multipart[0].hr_class->hc_hash)
++       return (msg_header_t **)((char *)mo + mc->mc_multipart[0].hr_offset);
+ 
+   return NULL;
+ }
+-- 
+1.8.5.1
+
diff --git a/sofia-sip.spec b/sofia-sip.spec
index 3f205f0..e3c08b0 100644
--- a/sofia-sip.spec
+++ b/sofia-sip.spec
@@ -1,12 +1,13 @@
 Name:           sofia-sip
 Version:        1.12.11
-Release:        7%{?dist}
+Release:        8%{?dist}
 Summary:        Sofia SIP User-Agent library
 
 Group:          System Environment/Libraries
 License:        LGPLv2+
 URL:            http://sofia-sip.sourceforge.net/
 Source0:        http://dl.sourceforge.net/sofia-sip/%{name}-%{version}.tar.gz
+Patch0:         0001-fix-undefined-behaviour.patch
 
 #BuildRequires:  doxygen >= 1.3
 #BuildRequires:  graphviz
@@ -61,6 +62,8 @@ Command line utilities for the Sofia SIP UA library.
 
 %prep
 %setup0 -q -n sofia-sip-%{version}%{?work:work%{work}}
+%patch0 -p1
+
 
 %build
 %configure --disable-rpath --disable-static
@@ -119,6 +122,9 @@ find . -name installdox -delete
 %{_mandir}/man1/*.1*
 
 %changelog
+* Thu Dec  5 2013 Brian Pepple <bpepple at fedoraproject.org> - 1.12.11-8
+- Add patch to fix compiler error. (#981056)
+
 * Sun Aug 04 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.12.11-7
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 


More information about the scm-commits mailing list