Bug#342545: qt-x11-free build fails

2006-08-23 Thread Steve Langasek
tags 342545 patch
thanks

Right, here's an off-the-cuff patch, which gets me past the point of the
SIGBUS on paer.

The same bug exists in the handling of Inf and NaN, but I didn't bother
patching for those since those constants should always be defined on Debian
systems and the related code paths never triggered.

Cheers,
-- 
Steve Langasek   Give me a lever long enough and a Free OS
Debian Developer   to set it on, and I can move the world.
[EMAIL PROTECTED]   http://www.debian.org/
diff -u qt-x11-free-3.3.6/debian/changelog qt-x11-free-3.3.6/debian/changelog
--- qt-x11-free-3.3.6/debian/changelog
+++ qt-x11-free-3.3.6/debian/changelog
@@ -1,3 +1,11 @@
+qt-x11-free (3:3.3.6-3.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix the bogus assumption in src/tools/qlocale.cpp that a char[] can be
+cast to a double *.  Closes: #342545.
+
+ -- Steve Langasek <[EMAIL PROTECTED]>  Thu, 24 Aug 2006 00:17:09 -0600
+
 qt-x11-free (3:3.3.6-3) unstable; urgency=low
 
   +++ Changes by Christopher Martin
only in patch2:
unchanged:
--- qt-x11-free-3.3.6.orig/src/tools/qlocale.cpp
+++ qt-x11-free-3.3.6/src/tools/qlocale.cpp
@@ -122,13 +122,24 @@
 #endif
 
 // We can't rely on -NAN, since all operations on a NAN should return a NAN.
+static double be_neg_nan; 
+static double le_neg_nan;
 static const unsigned char be_neg_nan_bytes[] = { 0xff, 0xf8, 0, 0, 0, 0, 0, 0 
};
 static const unsigned char le_neg_nan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0xff 
};
+static bool neg_nan_init = false;
+
 static inline double negNan()
 {
+if (!neg_nan_init)
+{
+memcpy(&be_neg_nan,be_neg_nan_bytes,sizeof(be_neg_nan_bytes));
+memcpy(&le_neg_nan,le_neg_nan_bytes,sizeof(le_neg_nan_bytes));
+neg_nan_init = true;
+}
 return (ByteOrder == BigEndian ?
-*((const double *) be_neg_nan_bytes) :
-*((const double *) le_neg_nan_bytes));
+be_neg_nan : 
+le_neg_nan);
+
 }
 
 // Sizes as defined by the ISO C99 standard - fallback


signature.asc
Description: Digital signature


Bug#342545: qt-x11-free build fails

2006-08-23 Thread Steve Langasek
Right, so I noticed paer has been re-opened post-compromise, so I had a look
at this:

Program received signal SIGBUS, Bus error.
[Switching to Thread 16384 (LWP 19108)]
0x40cb2150 in negNan () at tools/qlocale.cpp:131
131 *((const double *) le_neg_nan_bytes));
(gdb) bt
#0  0x40cb2150 in negNan () at tools/qlocale.cpp:131
#1  0x40cbbe80 in qIsNan (d=3) at tools/qlocale.cpp:167
#2  0x40cbe6f4 in QLocalePrivate::doubleToString (this=0x40e48110, d=3, 
precision=6, form=QLocalePrivate::DFSignificantDigits, width=0, flags=0)
at tools/qlocale.cpp:3221
#3  0x40ce3604 in QString::setNum (this=0xc038adc8, n=3, f=103 'g', prec=6)
at tools/qstring.cpp:5282
#4  0x40bb46b4 in QDomElement::setAttribute (this=0xc038acd0, 
[EMAIL PROTECTED], value=3) at xml/qdom.cpp:4333
#5  0x0006684c in DomTool::fixDocument ([EMAIL PROTECTED])
at ../shared/domtool.cpp:389
#6  0x0001d420 in main (argc=6, argv=0xc038a528) at main.cpp:298
(gdb) 

I'd say that's pretty clearly not a libgcc bug.

Cheers,
-- 
Steve Langasek   Give me a lever long enough and a Free OS
Debian Developer   to set it on, and I can move the world.
[EMAIL PROTECTED]   http://www.debian.org/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]