[webkit-changes] [WebKit/WebKit] 5cfc81: Stop ignoring GCC's use-after-free warnings in CSS...

Žan Doberšek noreply at github.com
Thu Oct 27 07:26:35 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5cfc81b9eec95eec85ea355faec798f94c3912ac
      https://github.com/WebKit/WebKit/commit/5cfc81b9eec95eec85ea355faec798f94c3912ac
  Author: Žan Doberšek <zdobersek at igalia.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M Source/WebCore/css/CSSValue.h
    M Source/WebCore/css/StyleProperties.cpp
    M Source/WebCore/css/parser/CSSPropertyParser.cpp

  Log Message:
  -----------
  Stop ignoring GCC's use-after-free warnings in CSSValue::deref()
https://bugs.webkit.org/show_bug.cgi?id=247120

Reviewed by Michael Catanzaro.

The use-after-free warnings originating in CSSValue::deref() when compiling with
GCC were locally ignored. The few offending places are adjusted to fix the
warnings, and the IGNORE_GCC_WARNINGS macros are removed.

The warnings are usually thrown when specific optimization passes are enabled
and end up creating a use-after-free situation. In both current cases these
warnings can be ignored by simplifying the code.

In StyleProperties.cpp, the isValueID() and isValueIDIncludingList() functions
accepting a Ref<CSSValue> reference are simplified by accepting a trivial
CSSValue reference. If a Ref<CSSValue> is passed to these functions now, there's
a conversion operator on the Ref template that will handily retrieve the
reference. This also reduces reference-counting churn.

In CSSPropertyParser.cpp, getBaselineKeyword() is similarly simplified, now
accepting a CSSValue reference that's then downcasted into the primitive value,
and the sole call site is adjusted accordingly.

* Source/WebCore/css/CSSValue.h:
(WebCore::CSSValue::deref const):
* Source/WebCore/css/StyleProperties.cpp:
(WebCore::isValueID):
(WebCore::isValueIDIncludingList):
* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::getBaselineKeyword):
(WebCore::consumeContentDistributionOverflowPosition):

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




More information about the webkit-changes mailing list