Suspicous code in KDE 4 trunk r764353

Christoph Bartoschek bartoschek at gmx.de
Tue Jan 22 08:02:29 GMT 2008


Am Dienstag 22 Januar 2008 schrieb Allen Winter:
> I'll backport these fixes tomorrow.
> Christoph, thanks for this report.  I hope you can send them regularly.
> -Allen

Generating them is very time consuming and there has to be enough new code to 
check. Unfortunately I do not see how to directly only check changed files.

Greetings
Christoph

Here is what is left from the list:
-------------------------------------

- kdelibs/solid/solid/backends/fakehw/fakebattery.cpp:121

A break is missing


- kdelibs/knewstuff/knewstuff2/ui/kdxsbutton.cpp:150

Given the comment in line 146, a break might be missing.


- kdelibs/kate/completion/katecompletionconfig.cpp:176,226

The shift amount is negative on first iteration.


- kdemultimedia/juk/sortedstringlist.cpp:163

Line 153 indicates that previousNode could be NULL here.


- kdepimlibs/kioslave/imap4/imap4.cpp:359

Line 340 indicates that cache might be NULL here. 


- kdepimlibs/kblog/wordpressbuggy.cpp:129, 225
  kdepimlibs/kblog/gdata.cpp:299, 340, 396, 442
  
Is a warning enough?


- kdegames/kbounce/wall.cpp:256

A break seems to be missing.


- kdelibs/khtml/css/css_valueimpl.cpp:1234

docLoader remains NULL if line 1231 is false and crashes here.


- kdelibs/khtml/ecma/kjs_html.cpp:2396

A break statement or a fall-through comment should be here.


- kdebase/workspace/libs/ksysguard/processcore/processes_linux_p.cpp:365-377

There are break; statements missing.


- kdebase/workspace/libs/ksysguard/processcore/processes_remote_p.cpp:247

A break might be missing here. Or a fall-through comment.


- kdebase/workspace/libs/plasma/phase.cpp:257
  kdebase/workspace/libs/plasma/phase.cpp:295
  
Division by zero if frames is 1 or 2  (or 1 in line 295). 
Line 280 and 244 only catch the value 0. But frames is divided and
an integer in lines 255 and 293.

- kdebase/workspace/ksysguard/ksysguardd/Linux/netdev.c:420

There should be something as return here. fd is used in 423, 425,
428. I do not think that calling read or close with invalid
file descriptors is allowed.


- kdebase/workspace/ksysguard/ksysguardd/Linux/softraid.c:580
  kdebase/workspace/ksysguard/ksysguardd/Linux/softraid.c:580
  
I would expect a 6 instead of 4 as the third argument to strncmp.


- kdebase/workspace/kwin/clients/plastik/plastikbutton.cpp:203

alpha is not initialized if lines 194 and 198 are not true.


- kdebase/workspace/kwin/clients/b2/b2client.cpp:168
  kdebase/workspace/kwin/clients/b2/b2client.cpp:170

Highly probably two breaks are missing


- kdebase/workspace/kwin/effects/thumbnailaside.cpp:146

If it is possible that windows.size() == 0 then height is 0 here.


- kdebase/workspace/khotkeys/shared/input.cpp:189

keysym is uninitialized


- kdebase/workspace/khotkeys/shared/input.cpp:217 

x_mod is uninitialized


- kdebase/apps/konqueror/src/konqviewmanager.cpp:960

Line 950 indicates that m_pMainWindow might be NULL: Is it impossible to
get here?


- kdebase/apps/konqueror/sidebar/trees/dirtree_module/dirtree_item.cpp:170
  kdebase/apps/konqueror/settings/filetypes/kservicelistwidget.cpp:442
  kdegames/kpat/klondike.cpp:177
  kdegames/libkdegames/highscore/kexthighscore_gui.cpp:501

Useless "true &&".  


- kdebase/workspace/ksysguard/gui/WorkSheet.cc:522

newDisplay is NULL here if classType == "ProcessController"  and
mLocalProcessController != NULL. I guess line 512 should move out of the
if braces starting at 509


- kdebase/workspace/kwin/events.cpp:1664 

A break is probably missing.


- kdebase/workspace/kdm/kfrontend/genkdmconf.c:2812

ftxt is NULL if the for in 2876 is not entered.


- kdebase/workspace/khotkeys/kcontrol/condition_list_widget.cpp:285

If parent2_P is NULL and parent1_P is NULL this method crashes here


- kdebase/workspace/ksplash/ksplashx/scale.cpp:194
  kdebase/workspace/ksplash/ksplashx/scale.cpp:221
  kdebase/workspace/ksplash/ksplashx/scale.cpp:248

If d is 0 problems arise later.


- kdebase/workspace/ksplash/ksplashx/qcolor.cpp:503

Lines 505 and 507 use && and not &. This one of the reasons to use &&
here too.


- kdebase/apps/konsole/src/ViewManager.cpp:399

If existingViewIter.hasNext() is always false container is NULL here and
crashes.



A fall-through-comment or a real break might be missing here:
--------------------------------------------------------------

kdebase/workspace/kcontrol/kfontinst/kcmfontinst/FontList.cpp:800
kdebase/workspace/plasma/applets/kickoff/ui/urlitemview.cpp:295
kdebase/workspace/libs/plasma/widgets/widget.cpp:596
kdebase/runtime/kstyles/oxygen/oxygen.cpp:1816
kdebase/runtime/phonon/xine/mediaobject.cpp:555
kdelibs/phonon/tests/fakebackend/delayaudioeffect.cpp:70






More information about the kde-core-devel mailing list