Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid -Wuse-after-free warnings in DOMMatrix with GCC 12
https://bugs.webkit.org/show_bug.cgi?id=249910 Reviewed by Michael Catanzaro. GCC 12 sees issues with DOMMatrix::scaleSelf() and DOMMatrix::scale3dSelf() calling the translateSelf() method that returns a Ref<DOMMatrix> that holds a reference to the same DOMMatrix object. That Ref<DOMMatrix> gets destroyed when going out of scope, providing the never-taken codepath that destroys the DOMMatrix object if its reference count would fall to zero. This doesn't happen because of expectation that both methods initially start operation on the DOMMatrix object with a greater-than-zero reference count. Only after that do the two methods construct their own Ref<DOMMatrix> return value, which in theory would work on freed memory if that never-taken codepath was indeed taken. To avoid this, don't call translateSelf() but instead invoke directly the proper TransformationMatrix operations. * Source/WebCore/css/DOMMatrix.cpp: (WebCore::DOMMatrix::scaleSelf): (WebCore::DOMMatrix::scale3dSelf): Canonical link: https://commits.webkit.org/258346@main
- Loading branch information