Bug#777782: fix build using GCC 5

Matthias Klose doko at debian.org
Fri Jul 10 11:31:44 UTC 2015


Control: tags -1 + patch pending

attaching a patch for three issues, and uploading to delayed.
-------------- next part --------------
diff -Nru asterisk-13.1.0~dfsg/debian/changelog asterisk-13.1.0~dfsg/debian/changelog
--- asterisk-13.1.0~dfsg/debian/changelog	2014-12-31 22:11:17.000000000 +0100
+++ asterisk-13.1.0~dfsg/debian/changelog	2015-07-10 13:21:18.000000000 +0200
@@ -1,3 +1,17 @@
+asterisk (1:13.1.0~dfsg-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+
+  [ Matthias Klose ]
+  * Build with -fgnu89-inline. Closes: #777782.
+  * CVE-2015-1558: File descriptor leak when incompatible codecs are offered.
+    Closes: #780601.
+
+  [ James Cowgill ]
+  * Fix OSARCH detection on all linux architectures. Closes: #780287.
+
+ -- Matthias Klose <doko at debian.org>  Fri, 10 Jul 2015 12:56:51 +0200
+
 asterisk (1:13.1.0~dfsg-1) unstable; urgency=high
 
   [ Tzafrir Cohen ]
diff -Nru asterisk-13.1.0~dfsg/debian/patches/AST-2015-001-13.diff asterisk-13.1.0~dfsg/debian/patches/AST-2015-001-13.diff
--- asterisk-13.1.0~dfsg/debian/patches/AST-2015-001-13.diff	1970-01-01 01:00:00.000000000 +0100
+++ asterisk-13.1.0~dfsg/debian/patches/AST-2015-001-13.diff	2015-07-10 13:19:19.000000000 +0200
@@ -0,0 +1,165 @@
+Index: res/res_pjsip_sdp_rtp.c
+===================================================================
+--- ./res/res_pjsip_sdp_rtp.c	(revision 431302)
++++ ./res/res_pjsip_sdp_rtp.c	(revision 431303)
+@@ -1242,6 +1242,7 @@
+ 		ast_rtp_instance_stop(session_media->rtp);
+ 		ast_rtp_instance_destroy(session_media->rtp);
+ 	}
++	session_media->rtp = NULL;
+ }
+ 
+ /*! \brief SDP handler for 'audio' media stream */
+Index: res/res_pjsip_t38.c
+===================================================================
+--- ./res/res_pjsip_t38.c	(revision 431302)
++++ ./res/res_pjsip_t38.c	(revision 431303)
+@@ -818,6 +818,7 @@
+ 	if (session_media->udptl) {
+ 		ast_udptl_destroy(session_media->udptl);
+ 	}
++	session_media->udptl = NULL;
+ }
+ 
+ /*! \brief SDP handler for 'image' media stream */
+Index: res/res_pjsip_session.c
+===================================================================
+--- ./res/res_pjsip_session.c	(revision 431302)
++++ ./res/res_pjsip_session.c	(revision 431303)
+@@ -186,6 +186,26 @@
+ 	ao2_callback_data(sdp_handlers, OBJ_KEY | OBJ_UNLINK | OBJ_NODATA, remove_handler, (void *)stream_type, handler);
+ }
+ 
++/*!
++ * \brief Set an SDP stream handler for a corresponding session media.
++ *
++ * \note Always use this function to set the SDP handler for a session media.
++ *
++ * This function will properly free resources on the SDP handler currently being
++ * used by the session media, then set the session media to use the new SDP
++ * handler.
++ */
++static void session_media_set_handler(struct ast_sip_session_media *session_media,
++		struct ast_sip_session_sdp_handler *handler)
++{
++	ast_assert(session_media->handler != handler);
++
++	if (session_media->handler) {
++		session_media->handler->stream_destroy(session_media);
++	}
++	session_media->handler = handler;
++}
++
+ static int handle_incoming_sdp(struct ast_sip_session *session, const pjmedia_sdp_session *sdp)
+ {
+ 	int i;
+@@ -235,6 +255,9 @@
+ 			continue;
+ 		}
+ 		AST_LIST_TRAVERSE(&handler_list->list, handler, next) {
++			if (handler == session_media->handler) {
++				continue;
++			}
+ 			ast_debug(1, "Negotiating incoming SDP media stream '%s' using %s SDP handler\n",
+ 				session_media->stream_type,
+ 				handler->id);
+@@ -249,7 +272,7 @@
+ 					session_media->stream_type,
+ 					handler->id);
+ 				/* Handled by this handler. Move to the next stream */
+-				session_media->handler = handler;
++				session_media_set_handler(session_media, handler);
+ 				handled = 1;
+ 				break;
+ 			}
+@@ -317,6 +340,9 @@
+ 			continue;
+ 		}
+ 		AST_LIST_TRAVERSE(&handler_list->list, handler, next) {
++			if (handler == session_media->handler) {
++				continue;
++			}
+ 			ast_debug(1, "Applying negotiated SDP media stream '%s' using %s SDP handler\n",
+ 				session_media->stream_type,
+ 				handler->id);
+@@ -331,7 +357,7 @@
+ 					session_media->stream_type,
+ 					handler->id);
+ 				/* Handled by this handler. Move to the next stream */
+-				session_media->handler = handler;
++				session_media_set_handler(session_media, handler);
+ 				return CMP_MATCH;
+ 			}
+ 		}
+@@ -744,6 +770,9 @@
+ 			continue;
+ 		}
+ 		AST_LIST_TRAVERSE(&handler_list->list, handler, next) {
++			if (handler == session_media->handler) {
++				continue;
++			}
+ 			if (!handler->defer_incoming_sdp_stream) {
+ 				continue;
+ 			}
+@@ -753,15 +782,15 @@
+ 			case AST_SIP_SESSION_SDP_DEFER_NOT_HANDLED:
+ 				continue;
+ 			case AST_SIP_SESSION_SDP_DEFER_ERROR:
+-				session_media->handler = handler;
++				session_media_set_handler(session_media, handler);
+ 				return 0;
+ 			case AST_SIP_SESSION_SDP_DEFER_NOT_NEEDED:
+ 				/* Handled by this handler. */
+-				session_media->handler = handler;
++				session_media_set_handler(session_media, handler);
+ 				break;
+ 			case AST_SIP_SESSION_SDP_DEFER_NEEDED:
+ 				/* Handled by this handler. */
+-				session_media->handler = handler;
++				session_media_set_handler(session_media, handler);
+ 				return 1;
+ 			}
+ 			/* Move to the next stream */
+@@ -923,9 +952,21 @@
+ static void session_media_dtor(void *obj)
+ {
+ 	struct ast_sip_session_media *session_media = obj;
+-	if (session_media->handler) {
+-		session_media->handler->stream_destroy(session_media);
++	struct sdp_handler_list *handler_list;
++	/* It is possible for SDP handlers to allocate memory on a session_media but
++	 * not end up getting set as the handler for this session_media. This traversal
++	 * ensures that all memory allocated by SDP handlers on the session_media is
++	 * cleared (as well as file descriptors, etc.).
++	 */
++	handler_list = ao2_find(sdp_handlers, session_media->stream_type, OBJ_KEY);
++	if (handler_list) {
++		struct ast_sip_session_sdp_handler *handler;
++
++		AST_LIST_TRAVERSE(&handler_list->list, handler, next) {
++			handler->stream_destroy(session_media);
++		}
+ 	}
++	ao2_cleanup(handler_list);
+ 	if (session_media->srtp) {
+ 		ast_sdp_srtp_destroy(session_media->srtp);
+ 	}
+@@ -2092,6 +2133,9 @@
+ 
+ 	/* no handler for this stream type and we have a list to search */
+ 	AST_LIST_TRAVERSE(&handler_list->list, handler, next) {
++		if (handler == session_media->handler) {
++			continue;
++		}
+ 		res = handler->create_outgoing_sdp_stream(session, session_media, answer);
+ 		if (res < 0) {
+ 			/* catastrophic error */
+@@ -2099,7 +2143,7 @@
+ 		}
+ 		if (res > 0) {
+ 			/* Handled by this handler. Move to the next stream */
+-			session_media->handler = handler;
++			session_media_set_handler(session_media, handler);
+ 			return CMP_MATCH;
+ 		}
+ 	}
diff -Nru asterisk-13.1.0~dfsg/debian/patches/configure-osarch asterisk-13.1.0~dfsg/debian/patches/configure-osarch
--- asterisk-13.1.0~dfsg/debian/patches/configure-osarch	1970-01-01 01:00:00.000000000 +0100
+++ asterisk-13.1.0~dfsg/debian/patches/configure-osarch	2015-07-10 12:58:55.000000000 +0200
@@ -0,0 +1,11 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -178,7 +178,7 @@ case "${host_os}" in
+      OSARCH=cygwin
+      PBX_WINARCH=1
+      ;;
+-     linux-gnueabi* |  linux-gnuspe)
++     linux-gnu*)
+      OSARCH=linux-gnu
+      ;;
+      kfreebsd*-gnu)
diff -Nru asterisk-13.1.0~dfsg/debian/patches/series asterisk-13.1.0~dfsg/debian/patches/series
--- asterisk-13.1.0~dfsg/debian/patches/series	2014-12-17 06:57:59.000000000 +0100
+++ asterisk-13.1.0~dfsg/debian/patches/series	2015-07-10 13:19:35.000000000 +0200
@@ -23,3 +23,6 @@
 aelparse_enable.patch
 systemd.patch
 #test_framework.patch
+
+configure-osarch
+AST-2015-001-13.diff
diff -Nru asterisk-13.1.0~dfsg/debian/rules asterisk-13.1.0~dfsg/debian/rules
--- asterisk-13.1.0~dfsg/debian/rules	2014-12-31 12:06:47.000000000 +0100
+++ asterisk-13.1.0~dfsg/debian/rules	2015-07-10 12:58:39.000000000 +0200
@@ -78,7 +78,7 @@
 override_dh_auto_configure:
 	chmod 755 $(CURDIR)/debian/dummyprogs/fetch
 	$(FETCH_ENV) ./configure			\
-		CFLAGS="$(CFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \
+		CFLAGS="-fgnu89-inline $(CFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \
 		--host=$(DEB_HOST_GNU_TYPE)		\
 		--build=$(DEB_BUILD_GNU_TYPE)		\
 		--prefix=/usr				\


More information about the Pkg-voip-maintainers mailing list