Bug in Qt4's rcc.exe
Andreas Hausladen <[email protected]> Sun, 21 Aug 2005 20:20:10 +0200
| Newsgroups | gmane.comp.kde.devel.cygwin |
|---|---|
| Message-ID | <[email protected]> |
There is a bug in src/tools/rcc.cpp which raises a float point division by zero (appears as access violation). This does not happen if rcc is compiled with QT_NO_COMPRESS. The bug is in Qt 4.0.0 and 4.0.1. And there seems to be a buffer overflow in moc.exe but I'm not sure if it is really moc or another bug in the Borland C++ Compiler 5.5.1/5.6.4. The synthom is that moc.exe sometimes crashes while allocating memory. But this "sometimes" means that if I change my PATH enviroment variable (add some stupid chars or remove some entries) moc.exe processes the files. If I add a Preprocessor::Macros["blabla"] = "nonsens"; then I have to make other changes (or even non) to the PATH envvar. Another solution is to change to a subdirectory and start the makefile. Adding further DEFINEs to the command line change moc's behaviour, too. But all these solutions are not garanteed to work. That really looks like a buffer overflow. And it only happens with Borland's memory manager (and that one is not the problem as it is the MM from C++Builder. And there are lots of programs in productive use, using this MM). "Unfortunatelly" moc.exe does not crash while debugging so finding the bug (may it a bug in moc or bcc32) is not really easy. I can only identify the location where it crashes because the memory was overwritten but that code is not the problem. Regards, Andreas Hausladen _______________________________________________ kde-cygwin mailing list [email protected] https://mail.kde.org/mailman/listinfo/kde-cygwin
rcc.cpp.patch
(text/plain, 710 B)
Index: src/tools/rcc/rcc.cpp
===================================================================
RCS file: d:\CVS\Qt4/qt-4.0.1/src/tools/rcc/rcc.cpp,v
retrieving revision 1.1
diff -u -r1.1 rcc.cpp
--- src/tools/rcc/rcc.cpp 20 Aug 2005 00:09:57 -0000 1.1
+++ src/tools/rcc/rcc.cpp 21 Aug 2005 17:49:39 -0000
@@ -140,7 +140,7 @@
#ifndef QT_NO_COMPRESS
// Check if compression is useful for this file
- if (mCompressLevel != 0) {
+ if (mCompressLevel != 0 && data.size() > 0) {
QByteArray compressed = qCompress(reinterpret_cast<uchar *>(data.data()), data.size(), mCompressLevel);
int compressRatio = int(100.0f * (float(data.size() - compressed.size()) / float(data.size())));