From 1e9714a050109af2bcfa8345cae0ba247638ab6f Mon Sep 17 00:00:00 2001
From: Joshua Colp <jcolp@digium.com>
Date: Mon, 26 Aug 2019 09:53:27 -0300
Subject: [PATCH] AST-2019-005 - translate: Don't assume all frames will have a
 src.

This change removes the assumption that a frame will always have
a src set on it. This assumption is incorrect.

Given a scenario where an RTP packet is received with no payload
the resulting audio frame will have no samples. If this frame goes
through a signed linear translation path an interpolated frame can
be created (if generic packet loss concealment is enabled) that has
minimal data on it, including no src. If this frame is given to a
translation path a crash will occur due to the lack of src.

ASTERISK-28499

Change-Id: I024d10dd98207eb8a6b35b59880bcdf1090538f8
---
 main/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/main/translate.c b/main/translate.c
index fe464602cb..5542107ae0 100644
--- a/main/translate.c
+++ b/main/translate.c
@@ -403,7 +403,7 @@ static int framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
 
 	if (f->samples == 0) {
 		/* Do not log empty audio frame */
-		if (strcasecmp(f->src, "ast_prod")) {
+		if (!f->src || strcasecmp(f->src, "ast_prod")) {
 			ast_log(LOG_WARNING, "no samples for %s\n", pvt->t->name);
 		}
 	}
-- 
GitLab