Issue 127044

Summary: Defects in the code
Product: Base Reporter: AppChecker <appchecker>
Component: codeAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Normal    
Priority: P5 (lowest) CC: appchecker, damjan, mseidel, oooforum
Version: 4.2.0-dev   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description AppChecker 2016-07-15 13:54:16 UTC
We checked AOO by static analyzer AppChecker  (https://cnpo.ru/en/solutions/appchecker.php)  and it found some possible defects:


1) The left and the right parts of the binary expression are indetical
main/binaryurp/source/lessoperators.cxx, line 43

https://github.com/apache/openoffice/blob/c014b5f2b55cff8d4b0c952d5c16d62ecde09ca1/main/binaryurp/source/lessoperators.cxx#L43

if( rA.eTypeClass != rA.eTypeClass)



2) The left and the right parts of the binary expression are indetical
main/editeng/source/accessibility/AccessibleStaticTextBase.cxx line 362
https://github.com/apache/openoffice/blob/c014b5f2b55cff8d4b0c952d5c16d62ecde09ca1/main/editeng/source/accessibility/AccessibleStaticTextBase.cxx#L362

if( aTextSegment.SegmentStart != -1 &&
            aTextSegment.SegmentStart != -1 )



3) The left and the right parts of the binary expression are indetical
main/editeng/source/uno/unotext.cxx, line 1943
https://github.com/apache/openoffice/blob/c014b5f2b55cff8d4b0c952d5c16d62ecde09ca1/main/editeng/source/uno/unotext.cxx#L1943


aRange.nStartPara = aRange.nStartPara;


4) The left and the right parts of the binary expression are indetical
main/sc/source/ui/unoobj/chart2uno.cxx line 640
https://github.com/apache/openoffice/blob/c014b5f2b55cff8d4b0c952d5c16d62ecde09ca1/main/sc/source/ui/unoobj/chart2uno.cxx#L640

if (nRow > 0 && nRow > 0)


5) The left and the right parts of the binary expression are indetical
main/svtools/source/dialogs/addresstemplate.cxx line 187
https://github.com/apache/openoffice/blob/c014b5f2b55cff8d4b0c952d5c16d62ecde09ca1/main/svtools/source/dialogs/addresstemplate.cxx#L187

for (;pFields != pFields; ++pFields)


6) The left and the right parts of the binary expression are indetical 
main/tools/source/fsys/dirent.cxx, line 2670
https://github.com/apache/openoffice/blob/c014b5f2b55cff8d4b0c952d5c16d62ecde09ca1/main/tools/source/fsys/dirent.cxx#L2670


                if ( pNewDir->eFlag == FSYS_FLAG_ABSROOT ||
                         pNewDir->eFlag == FSYS_FLAG_ABSROOT ... )


7) The left and the right parts of the binary expression are indetical
main/sc/source/core/tool/viewopti.cxx, line 107
https://github.com/apache/openoffice/blob/c014b5f2b55cff8d4b0c952d5c16d62ecde09ca1/main/sc/source/core/tool/viewopti.cxx#L107

	return (   nFldDrawX		== rCpy.nFldDrawX
			&& nFldDrawX		== rCpy.nFldDrawX ...)


8) Using  bitwise operation to the boolean expression
main/framework/source/uielement/newmenucontroller.cxx, line 255
https://github.com/apache/openoffice/blob/c014b5f2b55cff8d4b0c952d5c16d62ecde09ca1/main/framework/source/uielement/newmenucontroller.cxx#L255

 if ( nId & ( pPopupMenu->GetItemType( nId ) != MENUITEM_SEPARATOR ))
Comment 1 oooforum (fr) 2016-07-18 06:59:10 UTC
You can submit a patch with these corrections.
Comment 2 AppChecker 2017-01-30 12:48:57 UTC
9) The left and the right parts of the binary expression are indetical
main/scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java, line 94

https://github.com/apache/openoffice/blob/c014b5f2b55cff8d4b0c952d5c16d62ecde09ca1/main/scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java#L94

descriptor = descriptor;

I think it should be:

this.descriptor = descriptor;

10) The left and the right parts of the binary expression are indetical
main/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/FontDescription.java, line 161

https://github.com/apache/openoffice/blob/c014b5f2b55cff8d4b0c952d5c16d62ecde09ca1/main/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/FontDescription.java#L161

if (EndianConverter.readShort(dwHeight) !=
        EndianConverter.readShort(dwHeight))

I guess it should be:

if (EndianConverter.readShort(dwHeight) !=
        EndianConverter.readShort(rhs.dwHeight))
Comment 3 SVN Robot 2017-11-09 05:54:19 UTC
"damjan" committed SVN revision 1814705 into trunk:
#127044# - Defects in the code
Comment 4 damjan 2017-11-09 05:55:32 UTC
1, 2, 5, 9 and 10 are simple and obvious and have been committed in revision 1814705. The others need more research and testing.


Thank you for your bug report!
Comment 5 Matthias Seidel 2023-02-28 14:19:53 UTC
The existing part was cherry-picked for AOO41X with:
https://github.com/apache/openoffice/commit/441693ebd5224cbcf861f80a400de51a591b769d