[asterisk-commits] Fix crash in audiohook translate to slin (asterisk[11])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Dec 4 09:04:34 CST 2015


Matt Jordan has submitted this change and it was merged.

Change subject: Fix crash in audiohook translate to slin
......................................................................


Fix crash in audiohook translate to slin

This patch fixes a crash which would occur when an audiohook was
applied to a channel using an audio codec that could not be translated
to signed linear (such as when using pass-through codecs like OPUS or
when the codec translator module for the format in use is not loaded).

ASTERISK-25498 #close
Reported by: Ben Langfeld

Change-Id: Ib6ea7373fcc22e537cad373996136636201f4384
---
M main/audiohook.c
1 file changed, 9 insertions(+), 3 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, approved
  Walter Doekes: Looks good to me, but someone else must approve



diff --git a/main/audiohook.c b/main/audiohook.c
index c1df580..f9c0abe 100644
--- a/main/audiohook.c
+++ b/main/audiohook.c
@@ -765,12 +765,18 @@
 	}
 
 	if (ast_format_cmp(&frame->subclass.format, &in_translate->format) == AST_FORMAT_CMP_NOT_EQUAL) {
+		struct ast_trans_pvt *new_trans;
+
+		new_trans = ast_translator_build_path(ast_format_set(&tmp_fmt, slin_id, 0), &frame->subclass.format);
+		if (!new_trans) {
+			return NULL;
+		}
+
 		if (in_translate->trans_pvt) {
 			ast_translator_free_path(in_translate->trans_pvt);
 		}
-		if (!(in_translate->trans_pvt = ast_translator_build_path(ast_format_set(&tmp_fmt, slin_id, 0), &frame->subclass.format))) {
-			return NULL;
-		}
+		in_translate->trans_pvt = new_trans;
+
 		ast_format_copy(&in_translate->format, &frame->subclass.format);
 	}
 	if (!(new_frame = ast_translate(in_translate->trans_pvt, frame, 0))) {

-- 
To view, visit https://gerrit.asterisk.org/1762
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib6ea7373fcc22e537cad373996136636201f4384
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Walter Doekes <walter+asterisk at wjd.nu>



More information about the asterisk-commits mailing list