Merge lp:~bregma/compiz/lp-1101554 into lp:compiz/0.9.12

Proposed by Stephen M. Webb
Status: Merged
Approved by: Christopher Townsend
Approved revision: 3908
Merged at revision: 3913
Proposed branch: lp:~bregma/compiz/lp-1101554
Merge into: lp:compiz/0.9.12
Diff against target: 40 lines (+9/-0)
1 file modified
plugins/animation/src/dodge.cpp (+9/-0)
To merge this branch: bzr merge lp:~bregma/compiz/lp-1101554
Reviewer Review Type Date Requested Status
Christopher Townsend Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+243405@code.launchpad.net

Commit message

dodge plugin: avoid potential null pointer dereferences

Description of the change

Avoid potential NULL pointer dereferences in the Dodge plugin.

The code was using dynamic_cast<>() to downcast animation pointers, and sometimes did not check the result. It may be the case that dynamic_cast<>() is inappropriate and should be replaced by static_cast<>() but that would take a good deal more analysis and some good unit tests (which in turn would necessitate an ABI break), something that's not going ot happen in the forseeable future.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~bregma/compiz/lp-1101554 updated
3908. By Stephen M. Webb

fixed sudden but inevitable change of variable name

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Christopher Townsend (townsend) wrote :

Yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/animation/src/dodge.cpp'
2--- plugins/animation/src/dodge.cpp 2013-05-19 15:04:07 +0000
3+++ plugins/animation/src/dodge.cpp 2014-12-02 18:48:14 +0000
4@@ -232,6 +232,9 @@
5 DodgeAnim *animDodger =
6 dynamic_cast<DodgeAnim *> (adw->curAnimation ());
7
8+ if (!animDodger)
9+ continue;
10+
11 if (!(animDodger->mTransformProgress > 0.5f))
12 break;
13 }
14@@ -456,6 +459,8 @@
15 if (curAnim && curAnim->info () == AnimEffectDodge)
16 {
17 DodgeAnim *animDodger = dynamic_cast<DodgeAnim *> (curAnim);
18+ if (!animDodger)
19+ continue;
20
21 if (animDodger->mDodgeSubjectWin == mWindow)
22 animDodger->mDodgeSubjectWin = NULL;
23@@ -604,6 +609,8 @@
24 }
25
26 DodgeAnim *animDodger = dynamic_cast<DodgeAnim *> (adw->curAnimation ());
27+ if (!animDodger)
28+ continue;
29
30 animDodger->mDodgeSubjectWin = mWindow;
31
32@@ -823,6 +830,8 @@
33 continue;
34
35 DodgeAnim *dodgeAnim = dynamic_cast<DodgeAnim *> (curAnim);
36+ if (!dodgeAnim)
37+ continue;
38
39 dodgeAnim->mDodgeMaxAmountX = dodgeAmountX + offsetX;
40 dodgeAnim->mDodgeMaxAmountY = dodgeAmountY + offsetY;

Subscribers

People subscribed via source and target branches