[asterisk-commits] kmoore: branch 11 r379719 - in /branches/11: ./ codecs/codec_ilbc.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 21 12:33:16 CST 2013


Author: kmoore
Date: Mon Jan 21 12:33:12 2013
New Revision: 379719

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379719
Log:
Prevent segfault for interpolated iLBC frames

When iLBC is being used with a jitter buffer and the jb has to
interpolate frames, it generates frames with a null pointer and a
non-zero datalen. This is now be handled properly.

(closes issue ASTERISK-20914)
Patches:
  ASTERISK-20914-1.8.diff uploaded by Matt Jordan (license 6283)
........

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

Modified:
    branches/11/   (props changed)
    branches/11/codecs/codec_ilbc.c

Propchange: branches/11/
------------------------------------------------------------------------------
--- branch-1.8-merged (original)
+++ branch-1.8-merged Mon Jan 21 12:33:12 2013
@@ -1,1 +1,1 @@
-/branches/1.8:1-378147,378164,378356,378375,378427,378455-378456,378486,378514,378554,378591,378733,378776,378933,378967,379001,379145,379178,379226,379276,379310,379342,379392,379547,379608
+/branches/1.8:1-378147,378164,378356,378375,378427,378455-378456,378486,378514,378554,378591,378733,378776,378933,378967,379001,379145,379178,379226,379276,379310,379342,379392,379547,379608,379718

Modified: branches/11/codecs/codec_ilbc.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/codecs/codec_ilbc.c?view=diff&rev=379719&r1=379718&r2=379719
==============================================================================
--- branches/11/codecs/codec_ilbc.c (original)
+++ branches/11/codecs/codec_ilbc.c Mon Jan 21 12:33:12 2013
@@ -96,27 +96,29 @@
 	/* Assuming there's space left, decode into the current buffer at
 	   the tail location.  Read in as many frames as there are */
 	int x,i;
+	int datalen = f->datalen;
 	int16_t *dst = pvt->outbuf.i16;
 	ilbc_block tmpf[ILBC_SAMPLES];
 
-	if (!f->data.ptr && f->datalen) {
-		ast_debug(1, "issue 16070, ILIB ERROR. data = NULL datalen = %d src = %s\n", f->datalen, f->src ? f->src : "no src set");
+	if (!f->data.ptr && datalen) {
+		ast_debug(1, "issue 16070, ILIB ERROR. data = NULL datalen = %d src = %s\n", datalen, f->src ? f->src : "no src set");
 		f->datalen = 0;
-	}
-
-	if (f->datalen == 0) { /* native PLC, set fake f->datalen and clear plc_mode */
-		f->datalen = ILBC_FRAME_LEN;
+		datalen = 0;
+	}
+
+	if (datalen == 0) { /* native PLC, set fake datalen and clear plc_mode */
+		datalen = ILBC_FRAME_LEN;
 		f->samples = ILBC_SAMPLES;
 		plc_mode = 0;	/* do native plc */
 		pvt->samples += ILBC_SAMPLES;
 	}
 
-	if (f->datalen % ILBC_FRAME_LEN) {
-		ast_log(LOG_WARNING, "Huh?  An ilbc frame that isn't a multiple of 50 bytes long from %s (%d)?\n", f->src, f->datalen);
+	if (datalen % ILBC_FRAME_LEN) {
+		ast_log(LOG_WARNING, "Huh?  An ilbc frame that isn't a multiple of 50 bytes long from %s (%d)?\n", f->src, datalen);
 		return -1;
 	}
 
-	for (x=0; x < f->datalen ; x += ILBC_FRAME_LEN) {
+	for (x=0; x < datalen ; x += ILBC_FRAME_LEN) {
 		if (pvt->samples + ILBC_SAMPLES > BUFFER_SAMPLES) {
 			ast_log(LOG_WARNING, "Out of buffer space\n");
 			return -1;




More information about the asterisk-commits mailing list