[xml] SIGFPE + small bug



Using libxml2-2.3.10 in a multi-threaded (not pthreads) environment, I got
a SIGFPE calling xmlInitParser().

The code in xmlXPathInit() where it bombs is xmlXPathDivideBy():
double xmlXPathDivideBy(double f, double fzero) {
    double ret;
#ifdef HAVE_SIGNAL
#ifdef SIGFPE
#ifdef SIG_IGN
    void (*sighandler)(int);
    sighandler = signal(SIGFPE, SIG_IGN);
#endif
#endif
#endif
    ret = f / fzero;
#ifdef HAVE_SIGNAL
#ifdef SIGFPE
#ifdef SIG_IGN
    signal(SIGFPE, sighandler);
#endif
#endif
#endif
    return(ret);
}

Apparently, HAVE_SIGNAL is not defined anywhere so the signal isn't
blocked; this is on FreeBSD (both 4.2 and 3.3).

Also, xmlXPathInit() contains a bug:
xmlXPathPINF = xmlXPathDivideBy(1.0, 0.0);
xmlXPathPINF = xmlXPathDivideBy(-1.0, 0.0);

That last line should set xmlXPathNINF instead.

                                                                    robert




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