Issue 127068 - Some bugs in source code (expression is always true/false)
Summary: Some bugs in source code (expression is always true/false)
Status: ACCEPTED
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: 4.1.2
Hardware: All All
: P5 (lowest) Normal (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-05 07:50 UTC by AppChecker
Modified: 2017-10-12 20:02 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description AppChecker 2016-08-05 07:50:49 UTC
Greetings!

We've checked your source code with AppChecker (https://npo-echelon.ru/en/solutions/appchecker.php) static analyzer and found some bugs:

1)
https://github.com/apache/openoffice/blob/c014b5f2b55cff8d4b0c952d5c16d62ecde09ca1/main/rdbmaker/source/rdbmaker/rdbmaker.cxx#L113

while (*p == ' ' && *p =='\t')

\*p can' be equal to ' ' and '\t' at the same time - so the expression is always false.

2)

https://github.com/apache/openoffice/blob/c014b5f2b55cff8d4b0c952d5c16d62ecde09ca1/main/sc/source/filter/xml/XMLStylesExportHelper.cxx#L229

(aValidation.aOperator == sheet::ConditionOperator_BETWEEN &&
            aValidation.aOperator == sheet::ConditionOperator_NOT_BETWEEN &&

This is the same thing as previous

3)
https://github.com/apache/openoffice/blob/c014b5f2b55cff8d4b0c952d5c16d62ecde09ca1/main/sw/source/ui/shells/basesh.cxx#L1117

 if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT)


Expression is always true.
If eHOrient is equal to text::HoriOrientation::LEFT, then eHOrient != text::HoriOrientation::NONE -> the whole expression is true
If eHOrient is equal to text::HoriOrientation::NONE, then eHOrient != text::HoriOrientation::LEFT-> the whole expression is true
If eHOrient is equal to another value (text::HoriOrientation::RIGHT), then eHOrient != text::HoriOrientation::NONE -> the whole expression is true

4)

https://github.com/apache/openoffice/blob/c014b5f2b55cff8d4b0c952d5c16d62ecde09ca1/main/sw/source/ui/shells/basesh.cxx#L1129


if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT || eHOrient != text::HoriOrientation::RIGHT)

Same as previous.

5)
https://github.com/apache/openoffice/blob/c014b5f2b55cff8d4b0c952d5c16d62ecde09ca1/main/sw/source/ui/shells/basesh.cxx#L1141

                    if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT || eHOrient != text::HoriOrientation::RIGHT)

Same as previous, expression is always true.

6) 
https://github.com/apache/openoffice/blob/c014b5f2b55cff8d4b0c952d5c16d62ecde09ca1/main/sw/source/ui/shells/basesh.cxx#L1123

if(eSurround != SURROUND_LEFT || eSurround != SURROUND_RIGHT)

Same as previous, expression is always true.

All bugs were found by Echelon team with AppChecker (https://npo-echelon.ru/en/solutions/appchecker.php) static analyzer.
Comment 1 oooforum (fr) 2016-08-08 17:40:30 UTC
Like issue 127044, please submit a patch:
https://bz.apache.org/ooo/attachment.cgi?bugid=127068&action=enter
Read this to create it:
https://wiki.openoffice.org/wiki/Svn_practices
Comment 2 Kay 2016-08-09 19:42:14 UTC
Thanks for passing this along. I have to say I've noticed these logic constructs myself in the past, and it has made me wonder(???) We will definitely investigate and correct as needed.