From 794181964eaa304a325f80ef6af300fc12d6073e Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Fri, 5 Sep 2008 13:35:01 +0000 Subject: Ticket #612: division by zero in pjlib stddev calculation causes crash/floating point exception in pjsua "dq" command on ARM platform git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2263 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib/include/pj/math.h | 1 + 1 file changed, 1 insertion(+) (limited to 'pjlib/include') diff --git a/pjlib/include/pj/math.h b/pjlib/include/pj/math.h index c8f7ce48..9d7653ec 100644 --- a/pjlib/include/pj/math.h +++ b/pjlib/include/pj/math.h @@ -167,6 +167,7 @@ PJ_INLINE(void) pj_math_stat_update(pj_math_stat *stat, int val) */ PJ_INLINE(unsigned) pj_math_stat_get_stddev(pj_math_stat *stat) { + if (stat->n == 0) return 0; return (pj_isqrt((unsigned)(stat->m2_/stat->n))); } -- cgit v1.2.3