Re: [xml] xpath.c division by zero

    >Date: Thu, 29 Mar 2001 02:35:08 -0500
    >From: Daniel Veillard <veillard redhat com>
    >Cc: xml gnome org
    >Reply-To: veillard redhat com
    >Content-Type: text/plain; charset=us-ascii
    >Content-Disposition: inline
    >User-Agent: Mutt/1.2i
    >Sender: xml-admin gnome org
    >Errors-To: xml-admin gnome org
    >X-BeenThere: xml gnome org
    >X-Loop: xml gnome org
    >X-Mailman-Version: 2.0beta5
    >Precedence: bulk
    >List-Id: The Gnome XML library mailing-list <>
    >On Wed, Mar 28, 2001 at 01:04:52PM -0800, Eric and Jennifer Johnson wrote:
    >> I just downloaded and build libxml 2.3.5, but I am getting an error when I
    >> run the sample program (gjobread).  I traced the problem to the xmlXPathInit
    >> function (below).  This function does division by zero three times.  What
    >> should it be doing?
    >  Exactly that. Those are needed to:
    >    - check that the environment don't barf (divide by zero
    >      on double precision IEEE floating point have a precise
    >      semantic)
    >    - initialize the values needed for the XPath computations.
    >If it breaks on your platform, well you can disable XPath or
    >send patches which fixes the problem for your OS/Compiler, but
    >verify first that the XPath regression tests still work

     I had this same problem on Irix 6.5. And this is the patch
     I have used. 

     #include <ieeefp.h> 

      // this fp stuff is needed because there is an intentional divide by
      // zero in xmlXPathInit().
      fp_except e = fpgetmask();
      xmlDocPtr docPtr = xmlParseFile(fileName.getData());

      You could replace the call to xmlParseFile by a call to 
      xmlXPathInit which I believe is not theoretically re-entrable. 
      Obivously this code could be put in xmlXPathInit, but I wasn't
      up to that at the time. 

      I may be wrong, but ieeefp.h seems to be an include that is 
      unique to SGI, or at least Linux does not have this include. 
      I am not too familiar with other Unices. 

      I should also note that by default Irix 6.5 does not require this.
      My problem was that, a package I was linking to makes it so that a 
      double precision divide by zero raises SIGFPE. 

      Anyhow,  maybe this helps you. 


| Craig W. Wright                 |  "The hard and brittle will surely fall; |
| spiral cs unm edu               |   the soft and supple will overcome."    | 
|  |                -Lao Tzu                  |

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]