]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
There was an invalid assumption when calculating the duration of a file that the...
authorMark Michelson <mmichelson@digium.com>
Mon, 18 Feb 2008 20:52:09 +0000 (20:52 +0000)
committerMark Michelson <mmichelson@digium.com>
Mon, 18 Feb 2008 20:52:09 +0000 (20:52 +0000)
was created properly. Unfortunately this led to a segfault in the situation where an unknown format was
specified in voicemail.conf and a voicemail was recorded. Now, we first check to be sure that the stream
was written correctly or else assume a zero duration.

(closes issue #12021)
Reported by: jakep
Tested by: putnopvut

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@103786 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/app.c

index d59f1d1cc567fd65f046fbf829e1b4d8bfd057d8..a71f46adc268a75a14c2c2b8afc50088d1432d62 100644 (file)
@@ -707,7 +707,7 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
         * message, otherwise we could get a situation where this stream is never
         * closed (which would create a resource leak).
         */
-       *duration = ast_tellstream(others[0]) / 8000;
+       *duration = others[0] ? ast_tellstream(others[0]) / 8000 : 0;
 
        if (!prepend) {
                for (x = 0; x < fmtcnt; x++) {