Issue 100481 - svx: ambiguous && and ||
Summary: svx: ambiguous && and ||
Status: CLOSED FIXED
Alias: None
Product: Draw
Classification: Application
Component: code (show other issues)
Version: DEV300m44
Hardware: All Linux, all
: P3 Trivial (vote)
Target Milestone: OOo 3.2
Assignee: ooo
QA Contact: issues@graphics
URL:
Keywords:
Depends on:
Blocks: 96084
  Show dependency tree
 
Reported: 2009-03-23 14:51 UTC by caolanm
Modified: 2010-01-23 12:48 UTC (History)
1 user (show)

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


Attachments
suspicious code (1.18 KB, patch)
2009-03-23 14:54 UTC, caolanm
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description caolanm 2009-03-23 14:52:00 UTC
X && Y || Z
binds operator precedence-wise as
(X && Y) || Z
not
X && (Y || Z)

so I am a little suspicious about...
source/dialog/numpages.cxx
where we have repeated patterns of...

if(bPreset || bModified && pActNum)
    *pSaveNum = *pActNum;

i.e. its clearly unsafe to dereference pActNum if it is NULL if bPreset if true
and bModified is false, but that is what would happen at the moment.

Are we sure that's what we want, if not the attached patch fixes them up.

Also note the first instance tests off pSaveNum which is different to the normal
pattern of testing pActNum, but otherwise the code is the same, which is also
suspicious
Comment 1 caolanm 2009-03-23 14:54:48 UTC
Created attachment 61120 [details]
suspicious code
Comment 2 ooo 2009-04-29 13:23:15 UTC
started, adding issue to CWS ka100
Comment 3 ooo 2009-05-15 17:02:11 UTC
fixed
Comment 4 ooo 2009-09-14 11:12:46 UTC
verified
Comment 5 caolanm 2010-01-23 12:48:07 UTC
closing