[asterisk-commits] mjordan: trunk r385635 - in /trunk: ./ channels/chan_alsa.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Apr 13 21:35:07 CDT 2013


Author: mjordan
Date: Sat Apr 13 21:35:04 2013
New Revision: 385635

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385635
Log:
Don't attempt to create a voice frame on a read error

Prior to this patch, a read error in snd_pcm_readi would still be treated as a
nominal result when constructing a voice frame from the expected data. Since
the value returned is negative, as opposed to the number of samples read,
this could result in a crash. With this patch, we now return a null frame
when a read error is detected.

Note that the patch on ASTERISK-21329 was modified slightly for this commit,
in that we bail immediately on detecting the read error, rather than bypassing
the construction of the voice frame.

(closes issue ASTERISK-21329)
Reported by: Keiichiro Kawasaki
patches:
  chan_alsa.diff uploaded by kawasaki (License 6489)
........

Merged revisions 385633 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 385634 from http://svn.asterisk.org/svn/asterisk/branches/11

Modified:
    trunk/   (props changed)
    trunk/channels/chan_alsa.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Modified: trunk/channels/chan_alsa.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_alsa.c?view=diff&rev=385635&r1=385634&r2=385635
==============================================================================
--- trunk/channels/chan_alsa.c (original)
+++ trunk/channels/chan_alsa.c Sat Apr 13 21:35:04 2013
@@ -483,6 +483,13 @@
 	} else if (r < 0) {
 		ast_log(LOG_ERROR, "Read error: %s\n", snd_strerror(r));
 	}
+
+	/* Return NULL frame on error */
+	if (r < 0) {
+		ast_mutex_unlock(&alsalock);
+		return &f;
+	}
+
 	/* Update positions */
 	readpos += r;
 	left -= r;




More information about the asterisk-commits mailing list