[Asterisk-code-review] channel.c: Fix segfault with Monitor(wav,file,i) (asterisk[master])
Joshua C. Colp
asteriskteam at digium.com
Mon Jan 21 13:18:21 CST 2019
Joshua C. Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/10896 )
Change subject: channel.c: Fix segfault with Monitor(wav,file,i)
......................................................................
channel.c: Fix segfault with Monitor(wav,file,i)
If the Monitor is started with the i option the read_stream will be
NULL. One code path in channel.c checks if write_stream is set but than
uses read_stream instead causing a segfault.
ASTERISK-28249
Change-Id: I1bae9126537be54895c7fea2d08dd9488d8cc525
---
M main/channel.c
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
George Joseph: Looks good to me, but someone else must approve
Joshua C. Colp: Looks good to me, but someone else must approve; Approved for Submit
Sean Bright: Looks good to me, approved
diff --git a/main/channel.c b/main/channel.c
index 4fb226d..bad1480 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -5225,7 +5225,7 @@
if (jump >= 0) {
jump = calc_monitor_jump((ast_channel_insmpl(chan) - ast_channel_outsmpl(chan)),
ast_format_get_sample_rate(f->subclass.format),
- ast_format_get_sample_rate(ast_channel_monitor(chan)->read_stream->fmt->format));
+ ast_format_get_sample_rate(ast_channel_monitor(chan)->write_stream->fmt->format));
if (ast_seekstream(ast_channel_monitor(chan)->write_stream, jump, SEEK_FORCECUR) == -1) {
ast_log(LOG_WARNING, "Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n");
}
@@ -5236,7 +5236,7 @@
#else
int jump = calc_monitor_jump((ast_channel_insmpl(chan) - ast_channel_outsmpl(chan)),
ast_format_get_sample_rate(f->subclass.format),
- ast_format_get_sample_rate(ast_channel_monitor(chan)->read_stream->fmt->format));
+ ast_format_get_sample_rate(ast_channel_monitor(chan)->write_stream->fmt->format));
if (jump - MONITOR_DELAY >= 0) {
if (ast_seekstream(ast_channel_monitor(chan)->write_stream, jump - cur->samples, SEEK_FORCECUR) == -1) {
ast_log(LOG_WARNING, "Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n");
--
To view, visit https://gerrit.asterisk.org/10896
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I1bae9126537be54895c7fea2d08dd9488d8cc525
Gerrit-Change-Number: 10896
Gerrit-PatchSet: 1
Gerrit-Owner: Valentin Vidić <vvidic at valentin-vidic.from.hr>
Gerrit-Reviewer: Friendly Automation (1000185)
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua C. Colp <jcolp at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190121/56ecd233/attachment.html>
More information about the asterisk-code-review
mailing list