[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Review Request: Fix sanitization of dbus path in KMainWindow
From:       Thiago Macieira <thiago () kde ! org>
Date:       2009-08-18 6:23:55
Message-ID: 200908180824.02818.thiago () kde ! org
[Download RAW message or body]

[Attachment #2 (Text/Plain)]

Thomas Lübking wrote:
>Am Monday 17 August 2009 schrieb Matthew Woehlke:
>> Thomas Lübking wrote:
>> > Performance ain't crucial here (and QChar::isLetter() just tests
>> > some flags), but i just tested and QChar grants ::isLetter to really
>> > a lot of stuff (esp. as any utf-8 char seems to be split an the
>> > first part becomes a letter, though it's /no/ [A-Za-z] :-(
>>
>> Ah... doesn't that make QString::mid broken? (Or would that be QChar?)
>> Though that shouldn't be a problem if e.g. "駄" gets translated to
>> "G_q_".
>
>"駄" (except the """s") has QString::length() == 3

Wrong.

length is 1.

>all are represented by some weird "?" in a diamond, no substring matches
> the identifier regexp
>駄[0].isLetter() == true
>駄[1].isLetter() == false
>駄[2].isLetter() == false

Q_ASSERT on the second line. There's only one character.

>"ü" has QString::length() == 2

Wrong. It has length 1 too.

>all are represented by some weird "?" in a diamond, no substring matches
> the ü[0].isLetter() == true
>ü[1].isLetter() == false

Again Q_ASSERT on the second line.

>I don't know whether this makes QString or QChar "broken"* but the
> suggested solution guarantees a valid dbus path -regarding the object
> name- which in doubt ends up like "_________" ;-P

It means you just misused QString.

Please compile your code with #define QT_NO_CAST_FROM_ASCII and 
QT_NO_CAST_TO_ASCII.

>*i'd preferably force the whole world to restrict to ASCII - that's two
> more letters than the romans needed to control an empire for a
> millenium >-)

D-Bus paths are restricted to ASCII.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

Qt Developer Days 2009 | Registration Now Open!
Munich, Germany: Oct 12 - 14     San Francisco, California: Nov 2 - 4
      http://qt.nokia.com/qtdevdays2009

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic