Re: FTBFS if "-Werror=format-security" flag is used

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

 



On 12/06/2013 08:11 PM, Kevin Kofler wrote:
Adam Jackson wrote:

On Fri, 2013-12-06 at 02:21 +0100, Kevin Kofler wrote:

     QString line;
     line.fill( '-', 60 );
     qDebug( line.ascii() );
As you can see, the format string being passed here is provably constant.

So fix the compiler.

I don't think GCC will ever be able to prove that it is a constant. It would
at least have to do intermodule inlining on the linked qstring.o to do that,
which means qt3 would have to use the LTO support. Even then, I wouldn't
count on it. Plus, if this construct were found in application code rather
than in qt3 itself, GCC would even have to do the intermodule inlining on
libqt-mt, which would also have negative consequences on binary
compatibility.

But knowing the contract of QString (Qt 3's in this case, but it's the same
in Qt 4 and Qt 5), it's trivial for a human to prove it.

         Kevin Kofler

What is the best way to handle this case:

qWarning(QObject::tr("Client name '%1' occupied.").arg(name).toUtf8());

something like, or can I make it simpler:

qWarning("%s",qPrintable(QObject::tr("Client name '%1' occupied.").arg(name).toUtf8()));

regards

Brendan
--
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux