[Home]

Summary:ASTERISK-13413: [patch] Floating point exception crash when saying number between 9999 and 100000 with zh or tw language
Reporter:dant (dant)Labels:
Date Opened:2009-01-20 21:46:42.000-0600Date Closed:2009-01-21 16:11:10.000-0600
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Core/Internationalization
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) say.c-14291.diff
Description:Issue 12319 introduced some new code to say.c to make saying numbers in Chinese more correct... This code causes an asterisk crash when trying to say a number between 10000 and 99999 inclusive.

The crash occurs in ast_say_number_full_tw in say.c when performing
if (((num / 10000) % (num/100000)) == 0)
 playz++;
in the section of code that deal with numbers between 10000 and 100000000, which, for numbers below 100000 results in a divide by zero issue due to it being an integer operator causing an untrapped floating point exception.




****** ADDITIONAL INFORMATION ******

I'm not sure what the line is intended to do, but, it doesn't appear to do anything useful even with larger numbers, so I would suggest as it causes a crash that it is removed...

I'm hoping to rewrite this code at some point as it looks like it could be improved, but, before I do I wanted to report this crash bug...
Comments:By: dant (dant) 2009-01-20 22:39:20.000-0600

Patch uploaded (currently License PENDING, so may not be visible to all) that removes the mentioned line and also removes a few more lines from that function that cause it to add extra zeros when dealing with numbers over 99999 in a place they shouldn't be... e.g. 999999 should be 99 wan 9 thousand 9 hundred 99, without the additional lines removed it is said as 99 wan 09 thousand 9 hundred 99...

By: Mark Michelson (mmichelson) 2009-01-21 16:04:22.000-0600

Thanks for the patch. I'll get it merged in ASAP

By: Digium Subversion (svnbot) 2009-01-21 16:09:42.000-0600

Repository: asterisk
Revision: 169794

U   trunk/main/say.c

------------------------------------------------------------------------
r169794 | mmichelson | 2009-01-21 16:09:42 -0600 (Wed, 21 Jan 2009) | 17 lines

Fix a crash when saying certain numbers in Chinese

This commit fixes a crash that was occurring when attempting to
say a number between 10000 and 100000 due to dividing by 0.

This also removes some places where a "zero" is spoken when it
should not be.


(closes issue ASTERISK-13413)
Reported by: dant
Patches:
     say.c-14291.diff uploaded by dant (license 670)
Tested by: dant



------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=169794

By: Digium Subversion (svnbot) 2009-01-21 16:10:51.000-0600

Repository: asterisk
Revision: 169795

_U  branches/1.6.0/
U   branches/1.6.0/main/say.c

------------------------------------------------------------------------
r169795 | mmichelson | 2009-01-21 16:10:51 -0600 (Wed, 21 Jan 2009) | 25 lines

Merged revisions 169794 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
r169794 | mmichelson | 2009-01-21 16:10:02 -0600 (Wed, 21 Jan 2009) | 17 lines

Fix a crash when saying certain numbers in Chinese

This commit fixes a crash that was occurring when attempting to
say a number between 10000 and 100000 due to dividing by 0.

This also removes some places where a "zero" is spoken when it
should not be.


(closes issue ASTERISK-13413)
Reported by: dant
Patches:
     say.c-14291.diff uploaded by dant (license 670)
Tested by: dant



........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=169795

By: Digium Subversion (svnbot) 2009-01-21 16:11:09.000-0600

Repository: asterisk
Revision: 169796

_U  branches/1.6.1/
U   branches/1.6.1/main/say.c

------------------------------------------------------------------------
r169796 | mmichelson | 2009-01-21 16:11:09 -0600 (Wed, 21 Jan 2009) | 25 lines

Merged revisions 169794 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
r169794 | mmichelson | 2009-01-21 16:10:02 -0600 (Wed, 21 Jan 2009) | 17 lines

Fix a crash when saying certain numbers in Chinese

This commit fixes a crash that was occurring when attempting to
say a number between 10000 and 100000 due to dividing by 0.

This also removes some places where a "zero" is spoken when it
should not be.


(closes issue ASTERISK-13413)
Reported by: dant
Patches:
     say.c-14291.diff uploaded by dant (license 670)
Tested by: dant



........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=169796