[xml] Runtime exception occurs on mod operations when second arg is zero
- From: Chris_Poblete Dell com
- To: xml gnome org
- Subject: [xml] Runtime exception occurs on mod operations when second arg is zero
- Date: Sun, 26 Aug 2001 12:37:55 -0500
VERSIONS: libxml2-2.4.3
libxslt-1.0.3
PROBLEM:
The tag <xsl:when test="($row mod $col) = 0"> causes runtime exception
when $col happens to be zero. It would be correct to handle this case
by exiting the program gracefully (and perhaps show error message on debug).
PROPOSED RESOLUTION:
xpath.c:xmlXPathModValues(4425)
------------------------------------------------------------
< ctxt->value->floatval = arg1 % arg2;
----------
// When arg2 is zero at runtime, it will evaluate to 'divide by
zero'
// and will cause runtime exception. Instead check to allow
graceful exit.
if (arg2 == 0)
ctxt->value->floatval = xmlXPathNAN;
else
ctxt->value->floatval = arg1 % arg2;
------------------------------------------------------------
_______________________________
Chris Poblete
Dell © Enterprise Servers Group
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]