Enforce depth limits on flat math expression chains during parsing [chromium/src : main]

0 views
Skip to first unread message

Daniil Sakhapov (Gerrit)

unread,
May 4, 2026, 9:53:46 AM (23 hours ago) May 4
to Anders Hartvoll Ruud, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
Attention needed from Anders Hartvoll Ruud

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Anders Hartvoll Ruud
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I6e62c5ff187881c745b4b9a00912a13e3a123af4
Gerrit-Change-Number: 7813854
Gerrit-PatchSet: 1
Gerrit-Owner: Daniil Sakhapov <sakh...@chromium.org>
Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-Attention: Anders Hartvoll Ruud <and...@chromium.org>
Gerrit-Comment-Date: Mon, 04 May 2026 13:53:26 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Anders Hartvoll Ruud (Gerrit)

unread,
May 4, 2026, 10:27:57 AM (22 hours ago) May 4
to Daniil Sakhapov, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
Attention needed from Daniil Sakhapov

Anders Hartvoll Ruud added 3 comments

File third_party/blink/renderer/core/css/css_math_expression_node.cc
Line 5043, Patchset 1 (Latest): int result_depth = state.depth + 1;
Anders Hartvoll Ruud . unresolved

It would help with a comment here explaining that even though this is parsed iteratively, we want to avoid creating deep expression trees to avoid stack overflows later.

Line 5071, Patchset 1 (Latest): } else {
result_depth = state.depth + 1;
}
Anders Hartvoll Ruud . unresolved

I don't understand this "reset". Doesn't each iteration of this loop represent a new level?

File third_party/blink/web_tests/external/wpt/css/css-values/typed_arithmetic.html
Line 82, Patchset 1 (Latest):test_invalid_value("width", "calc(1px * 1px" + " * 2".repeat(200) + ")");
Anders Hartvoll Ruud . unresolved

This is only testing `ParseValueMultiplicativeExpression`, and not `ParseAdditiveValueExpression`, right?

Open in Gerrit

Related details

Attention is currently required from:
  • Daniil Sakhapov
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I6e62c5ff187881c745b4b9a00912a13e3a123af4
    Gerrit-Change-Number: 7813854
    Gerrit-PatchSet: 1
    Gerrit-Owner: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
    Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-Attention: Daniil Sakhapov <sakh...@chromium.org>
    Gerrit-Comment-Date: Mon, 04 May 2026 14:27:42 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Daniil Sakhapov (Gerrit)

    unread,
    7:30 AM (1 hour ago) 7:30 AM
    to Anders Hartvoll Ruud, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Anders Hartvoll Ruud

    Daniil Sakhapov voted and added 3 comments

    Votes added by Daniil Sakhapov

    Commit-Queue+1

    3 comments

    File third_party/blink/renderer/core/css/css_math_expression_node.cc
    Line 5043, Patchset 1: int result_depth = state.depth + 1;
    Anders Hartvoll Ruud . resolved

    It would help with a comment here explaining that even though this is parsed iteratively, we want to avoid creating deep expression trees to avoid stack overflows later.

    Daniil Sakhapov

    Done


    result_depth = state.depth + 1;
    }
    Anders Hartvoll Ruud . resolved

    I don't understand this "reset". Doesn't each iteration of this loop represent a new level?

    Daniil Sakhapov

    Done

    File third_party/blink/web_tests/external/wpt/css/css-values/typed_arithmetic.html
    Line 82, Patchset 1:test_invalid_value("width", "calc(1px * 1px" + " * 2".repeat(200) + ")");
    Anders Hartvoll Ruud . resolved

    This is only testing `ParseValueMultiplicativeExpression`, and not `ParseAdditiveValueExpression`, right?

    Daniil Sakhapov

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Anders Hartvoll Ruud
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I6e62c5ff187881c745b4b9a00912a13e3a123af4
      Gerrit-Change-Number: 7813854
      Gerrit-PatchSet: 2
      Gerrit-Owner: Daniil Sakhapov <sakh...@chromium.org>
      Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
      Gerrit-Reviewer: Daniil Sakhapov <sakh...@chromium.org>
      Gerrit-CC: Menard, Alexis <alexis...@intel.com>
      Gerrit-Attention: Anders Hartvoll Ruud <and...@chromium.org>
      Gerrit-Comment-Date: Tue, 05 May 2026 11:30:44 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Anders Hartvoll Ruud <and...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages