Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: eb617fc2899ad5c540d73f03d27f00963203b843
      
https://github.com/WebKit/WebKit/commit/eb617fc2899ad5c540d73f03d27f00963203b843
  Author: Taher Ali <[email protected]>
  Date:   2026-07-06 (Mon, 06 Jul 2026)

  Changed paths:
    A 
LayoutTests/svg/animations/animVal-detach-after-stopAnimation-crash-expected.txt
    A LayoutTests/svg/animations/animVal-detach-after-stopAnimation-crash.html
    M Source/WebCore/svg/properties/SVGAnimatedPropertyList.h
    M Source/WebCore/svg/properties/SVGAnimatedValueProperty.h

  Log Message:
  -----------
  SVGProperty::contextElement after stopAnimation drops m_animVal without 
detach()
https://bugs.webkit.org/show_bug.cgi?id=318365
rdar://177599904

Reviewed by Simon Fraser.

SVGAnimatedValueProperty<T>::ensureAnimVal() creates the animVal SVGProperty
with |this| as the raw SVGProperty::m_owner back-pointer. The destructor clears
it via detach(), but stopAnimation() and instanceStopAnimationImpl() set
m_animVal = nullptr without detaching first. Since the animVal is exposed to 
script via
SVGAnimatedLength.animVal and the JS wrapper holds an independent Ref, it can
outlive the SVGAnimatedValueProperty, leaving m_owner dangling. A later
len.value read reaches SVGProperty::contextElement() through freed memory.

SVGAnimatedPropertyList<T> has the identical pattern and is fixed the same way.

Detach m_animVal before releasing or overwriting it, via a detachAnimVal()
helper that mirrors the destructor.

Test: svg/animations/animVal-detach-after-stopAnimation-crash.html

* 
LayoutTests/svg/animations/animVal-detach-after-stopAnimation-crash-expected.txt:
 Added.
* LayoutTests/svg/animations/animVal-detach-after-stopAnimation-crash.html: 
Added.
* Source/WebCore/svg/properties/SVGAnimatedPropertyList.h:
(WebCore::SVGAnimatedPropertyList::detachAnimVal):
* Source/WebCore/svg/properties/SVGAnimatedValueProperty.h:
(WebCore::SVGAnimatedValueProperty::detachAnimVal):

Canonical link: https://commits.webkit.org/316557@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to