Suspicious code in kdevelop-3.3.2

Matt Rogers mattr at kde.org
Sun Apr 9 06:31:07 UTC 2006


On Saturday 08 April 2006 20:44, Christoph Bartoschek wrote:
> ------------------------------------------------------------------
> Misc problems:
> ------------------------------------------------------------------
>
> - languages/cpp/debugger/gdboutputwidget.cpp:102
>
> The string "(gdb) " has 6 characters and therefore the third argument
> should be 6 and not 5. Otherwise shorten the string.
>
> - parts/documentation/protocols/chm/chmfile.cpp:47
> - languages/cpp/subclassingdlg.cpp:300 (similar)
> - languages/kjssupport/subclassingdlg.cpp:319 (similar)
>
> Use delete [] buf and not delete buf. Or better: use std::vector<char>.

fixed with "delete []".

>
> - parts/documentation/protocols/chm/decompress.cpp:186
>
> When the loop at line 184 reaches i == 50, then in line 186
> extra_bits[i+1] <==> extra_bits[51] is set. But the range of array
> extra_bits is from 0 to 50.
>

fixed.

> - parts/filelist/projectviewpart.cpp:172
>
> If the if condition in line 153 is false, then line is used
> uninitialized in lines 172 and 174. col has a similar problem
>

fixed both line and col.

> - parts/doxygen/config.cpp:2483
>
> i controls the loop at line 2470 and 2483.
>

not fixed. way too cryptic to attempt ATM.

> ------------------------------------
> Problems involving the NULL pointer:
> ------------------------------------
>
> - languages/cpp/cppcodecompletion.cpp:1464
>
> If ast is NULL as indicated by line 1426, then line 1464 crashes.
>

fixed

> - languages/cpp/cppnewclassdlg.cpp:1535
>
> If no condition is true from lines 1525, 1527 and 1529, then line 1535
> crashes.
>

fixed

> - languages/cpp/createpcsdialog.cpp:260
>
> If m_settings is NULL as indicated by line 258, then line 260 crashes.
>

fixed

> - editors/qeditor/markerwidget.cpp:167
>
> If p is NULL as indicated by line 141, then line 167 crashes.
>
> - editors/qeditor/qeditor_view.cpp:394
>
> If edit is NULL as indicated by line 383, then line 394 crashes.
>
> - kdevdesigner/designer/resource.cpp:618
>
> If formwindows is NULL as indicated by line 608, then line 618 will crash.
>
> - kdevdesigner/designer/resource.cpp:840
>
> If obj is NULL as indicated by line 837, the call to
> WidgetFactory::classNameOf will crash or at least line 843.
>
> - kdevdesigner/designer/resource.cpp:1927
>
> If the if condition at line 1784 is false and the while loop at line
> 1849 is not entered, then w is never set and crashes in line 1926
>
> - kdevdesigner/designer/metadatabase.cpp:453
>
> If the conditions in lines 449 and 451 are not true, then ff is not set
> and line 453 crashes.
>
> - kdevdesigner/designer/mainwindow.cpp:1306
>
> If fw is NULL as indicated by line 1280, then line 1306 crashes.
>
> - kdevdesigner/designer/hierarchyview.cpp:888
>
> If itemFunct is NULL as indicated by line 857, then line 888 will crash.
>
> - kdevdesigner/uilib/qwidgetfactory.cpp:952
>
> If parent is NULL as indicated by line 916, then line 952 will crash.
>
> - kdevdesigner/uilib/qwidgetfactory.cpp:1098
>
> In line 909 widget is set to NULL. If the condition in line 915 is false
> and the case in line 1097 is selected, then line 1098 crashes.
>
> - kdevdesigner/uilib/qwidgetfactory.cpp:1222
> - kdevdesigner/uilib/qwidgetfactory.cpp:1328 (similar)
>
> If the switch in line 1209 first selects line 1213, then objects is
> still NULL and line 1222 crashes.
>
> - kdevdesigner/uilib/qwidgetfactory.cpp:394
>
> If widgetFactory->toplevel is NULL as indicated by line 350 and the for
> loop is entered in line 392, then line 394 crashes.
>
> - src/newui/buttonbar.cpp:78
>
> If the switch at line 66 does not select any case, then line 78 crashes.
>
> - lib/cppparser/parser.cpp:53
>
> The loop is executed at most once. Either it returns or it breakes.
>
>

didn't look at the rest of these, it's starting to get late.

> -----------------------------------------------------------------
> Cases from switch statements that fall through in some cases but
> do not have a fall through comment as in most such cases.
> ------------------------------------------------------------------
>
> - editors/qeditor/qeditor.cpp:225
> - editors/qeditor/qeditor.cpp:254

qeditor is going away in kdevelop 4 and is completely unmaintained. not fixed.

> - buildtools/qmake/trollprojectwidget.cpp:1594
> - buildtools/qmake/trollprojectwidget.cpp:1673

fixed. might have actually been the cause of a few bugs.

> - kdevdesigner/designer/formfile.cpp:333
> - kdevdesigner/designer/formwindow.cpp:737
> - kdevdesigner/designer/hierarchyview.cpp:807
> - kdevdesigner/designer/hierarchyview.cpp:817 (indendation)
> - lib/widgets/qcomboview.cpp:982
> - lib/widgets/propeditor/childproperty.cpp:131
> - lib/widgets/propeditor/childproperty.cpp:122
> - lib/widgets/propeditor/childproperty.cpp:117
>

i'm not sure about these other 8.

> -----------------------------------------------------------------
> Lines where boolean expressions are used in non-boolean contexts:
>
> I suspect that at least the lines marked with !!! are bugs
> -----------------------------------------------------------------
>
> - parts/filelist/projectviewpart.cpp:377 !!! (at least strange style)
> - parts/filelist/projectviewpart.cpp:474 !!! (at least strange style)

contains does not return a boolean type, so there is nothing to fix.

> - kdevdesigner/designer/mainwindow.cpp:2311

left alone for now.

> - parts/filecreate/filecreate_part.cpp:454

fixed

> - src/partcontroller.cpp:563

not sure what to do with this one.

> - lib/astyle/ASFormatter.cpp:1322
>

not messing with this since astyle is unmaintained.

Thanks for the wonderful analysis!
--
Matt




More information about the KDevelop-devel mailing list