diff options
| author | outfoxxed <outfoxxed@outfoxxed.me> | 2023-05-29 00:51:58 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-29 09:51:58 +0200 |
| commit | 409ff027f8adaba73ccf827eaa7856175fa7764d (patch) | |
| tree | aa72b14aed163ac8f4e736559908e90a00006f41 /src | |
| parent | 438d063ec684c2194563678ace5a625e6fb56517 (diff) | |
Fix UAF in animation end callback if callback deletes the animation (#2389)
Removes use after free when the end callback deletes the animation as
long as `m_bRemoveEndAfterRan` is false.
Diffstat (limited to 'src')
| -rw-r--r-- | src/helpers/AnimatedVariable.hpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/helpers/AnimatedVariable.hpp b/src/helpers/AnimatedVariable.hpp index 58efb956..d819ce1f 100644 --- a/src/helpers/AnimatedVariable.hpp +++ b/src/helpers/AnimatedVariable.hpp @@ -268,8 +268,10 @@ class CAnimatedVariable { // methods void onAnimationEnd() { if (m_fEndCallback) { + // loading m_bRemoveEndAfterRan before calling the callback allows the callback to delete this animation safely if it is false. + auto removeEndCallback = m_bRemoveEndAfterRan; m_fEndCallback(this); - if (m_bRemoveEndAfterRan) + if (removeEndCallback) m_fEndCallback = nullptr; // reset } } |
