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

List:       kde-commits
Subject:    KDE/kdelibs/kdeui/icons
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2010-09-10 17:52:34
Message-ID: 20100910175234.D3555AC884 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1173883 by aseigo:

prevent out-of-bounds accesses


 M  +12 -1     kiconeffect.cpp  


--- trunk/KDE/kdelibs/kdeui/icons/kiconeffect.cpp #1173882:1173883
@@ -77,6 +77,8 @@
     KSharedConfig::Ptr config = KGlobal::config();
 
     int i, j, effect=-1;
+    //FIXME: this really should be using KIconLoader::metaObject() to guarantee synchronization
+    // performance wise it's also practically guaranteed to be faster
     QStringList groups;
     groups += "Desktop";
     groups += "Toolbar";
@@ -149,12 +151,21 @@
 
 bool KIconEffect::hasEffect(int group, int state) const
 {
+    if (group < 0 || group >= KIconLoader::LastGroup ||
+        state < 0 || state >= KIconLoader::LastState) {
+        return false;
+    }
+
     return d->effect[group][state] != NoEffect;
 }
 
 QString KIconEffect::fingerprint(int group, int state) const
 {
-    if ( group >= KIconLoader::LastGroup ) return "";
+    if (group < 0 || group >= KIconLoader::LastGroup ||
+        state < 0 || state >= KIconLoader::LastState) {
+        return QString();
+    }
+
     QString cached = d->key[group][state];
     if (cached.isEmpty())
     {
[prev in list] [next in list] [prev in thread] [next in thread] 

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