Apache OpenOffice (AOO) Bugzilla – Issue 127068
Some bugs in source code (expression is always true/false)
Last modified: 2017-10-12 20:02:44 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.
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
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.