summaryrefslogtreecommitdiff
path: root/channels/chan_iax2.c
diff options
context:
space:
mode:
authorJim Dixon <telesistant@hotmail.com>2004-12-23 07:04:16 +0000
committerJim Dixon <telesistant@hotmail.com>2004-12-23 07:04:16 +0000
commit8e1a2d57a61e062b0ac8f937e65286b59434215c (patch)
tree922a2984320e7e302af5d08928ae02c62259062a /channels/chan_iax2.c
parenta2775a610957f7bdb441887042baf6d641c2ba42 (diff)
Fix Divide by zero possibility (ouch!)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4542 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_iax2.c')
-rwxr-xr-xchannels/chan_iax2.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 8346dc565..bec162f22 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;