From 8e1a2d57a61e062b0ac8f937e65286b59434215c Mon Sep 17 00:00:00 2001 From: Jim Dixon <telesistant@hotmail.com> Date: Thu, 23 Dec 2004 07:04:16 +0000 Subject: [PATCH] Fix Divide by zero possibility (ouch!) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4542 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_iax2.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 8346dc5655..bec162f222 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -2868,9 +2868,12 @@ static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, str * next multiple of frame size (so our * silent periods are multiples of * frame size too) */ - int diff = ms % (f->samples / 8); - if(diff) - ms += f->samples/8 - diff; + if (f->samples / 8) /* check to make sure we dont core dump */ + { + int diff = ms % (f->samples / 8); + if (diff) + ms += f->samples/8 - diff; + } p->nextpred = ms; p->notsilenttx = 1; -- GitLab