[Asterisk-code-review] Fix crash when using framehook without codec (asterisk[master])

Jonathan Rose asteriskteam at digium.com
Wed Dec 2 14:13:55 CST 2015


Jonathan Rose has uploaded a new change for review.

  https://gerrit.asterisk.org/1754

Change subject: Fix crash when using framehook without codec
......................................................................

Fix crash when using framehook without codec

If a framehook is applied to a channel that is using an audio codec
that Asterisk doesn't have a codec module for, this will cause a crash.
This appears to have been because the codec comparison used in the
translate to slin function didn't properly account for all enumerator
values returned by the format comparison function.

ASTERISK-25498 #close
Reported by: Ben Langfeld

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


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/54/1754/1

diff --git a/main/audiohook.c b/main/audiohook.c
index 73bb0ff..2be8a3a 100644
--- a/main/audiohook.c
+++ b/main/audiohook.c
@@ -822,9 +822,7 @@
 	slin = ast_format_cache_get_slin_by_rate(audiohook_list->list_internal_samp_rate);
 	if (ast_format_cmp(frame->subclass.format, slin) == AST_FORMAT_CMP_EQUAL) {
 		return new_frame;
-	}
-
-	if (ast_format_cmp(frame->subclass.format, in_translate->format) == AST_FORMAT_CMP_NOT_EQUAL) {
+	} else {
 		if (in_translate->trans_pvt) {
 			ast_translator_free_path(in_translate->trans_pvt);
 		}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib6ea7373fcc22e537cad373996136636201f4384
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Jonathan Rose <jrose at digium.com>



More information about the asterisk-code-review mailing list