Date: Mon, 23 Aug 2004 12:06:41 -0500 To: qt-bugs@trolltech.com Subject: bug in xpm color spec handling This bug is present in Qt 3.3.3 and in qt-x11-free-3.3.4-snapshot-20040822. In src/kernel/image.cpp: static int nextColorSpec(const QCString & buf) { int i = buf.find(" c "); if (i < 0) i = buf.find(" g "); if (i < 0) i = buf.find(" g4 "); if (i < 0) i = buf.find(" m "); if (i < 0) i = buf.find(" s "); return i; } This function assumes a particular order of the color specs in an XPM file that is not required by the XPM standard. Given the color line: ". c black m black g black g4 black s Legs ", The nextColorSpec call in: buf = buf.mid( i+3 ); // Strip any other colorspec int end = nextColorSpec(buf); if (end != -1) buf.truncate(end); will match on " g " instead of " m ", resulting in a color name of "black m " being passed to QColor::setNamedColor. Suggest replacing the sequence of buf.find's in nextColorSpec with a single buf.find using an appropriate QRegExp.