[Asterisk-code-review] format_ogg_speex: Implement a "not supported" write handler (asterisk[19])

Friendly Automation asteriskteam at digium.com
Thu Aug 5 14:29:39 CDT 2021


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/16259 )

Change subject: format_ogg_speex: Implement a "not supported" write handler
......................................................................

format_ogg_speex: Implement a "not supported" write handler

This format did not specify a "write" handler, so when attempting to write
to it (ast_writestream) a crash would occur.

This patch adds a default handler that simply issues a "not supported"
warning, thus no longer crashing.

ASTERISK-29539

Change-Id: I8f6ddc7cc3b15da30803be3b1cf68e2ba0fbce91
---
M formats/format_ogg_speex.c
1 file changed, 9 insertions(+), 0 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/formats/format_ogg_speex.c b/formats/format_ogg_speex.c
index ff26c9d..0d7a8fd 100644
--- a/formats/format_ogg_speex.c
+++ b/formats/format_ogg_speex.c
@@ -254,6 +254,12 @@
 	return -1;
 }
 
+static int ogg_speex_write(struct ast_filestream *s, struct ast_frame *f)
+{
+	ast_log(LOG_WARNING, "Writing is not supported on OGG/Speex streams!\n");
+	return -1;
+}
+
 /*!
  * \brief Seek to a specific position in an OGG/Speex filestream.
  * \param s The filestream to truncate.
@@ -277,6 +283,7 @@
 	.name = "ogg_speex",
 	.exts = "spx",
 	.open = ogg_speex_open,
+	.write = ogg_speex_write,
 	.seek = ogg_speex_seek,
 	.trunc = ogg_speex_trunc,
 	.tell = ogg_speex_tell,
@@ -290,6 +297,7 @@
 	.name = "ogg_speex16",
 	.exts = "spx16",
 	.open = ogg_speex_open,
+	.write = ogg_speex_write,
 	.seek = ogg_speex_seek,
 	.trunc = ogg_speex_trunc,
 	.tell = ogg_speex_tell,
@@ -303,6 +311,7 @@
 	.name = "ogg_speex32",
 	.exts = "spx32",
 	.open = ogg_speex_open,
+	.write = ogg_speex_write,
 	.seek = ogg_speex_seek,
 	.trunc = ogg_speex_trunc,
 	.tell = ogg_speex_tell,

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16259
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 19
Gerrit-Change-Id: I8f6ddc7cc3b15da30803be3b1cf68e2ba0fbce91
Gerrit-Change-Number: 16259
Gerrit-PatchSet: 2
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210805/4bbcab24/attachment.html>


More information about the asterisk-code-review mailing list