⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 275320 in webkit


Ignore:
Timestamp:
Mar 31, 2021, 4:38:30 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Null pointer access crash in WebCore::makeBoundaryPoint(..)
​https://bugs.webkit.org/show_bug.cgi?id=223977

Patch by Venky Dass <​yaranamavenkataramana@apple.com> on 2021-03-31
Reviewed by Darin Adler.

Source/WebCore:

In makeBoundaryPoint, position.containerNode() can be nullptr even if position.isNull() was false

Test: LayoutTests/editing/inserting/crash-make-boundary-point.html

  • dom/Position.cpp:

(WebCore::makeBoundaryPoint):

LayoutTests:

Adding a refression test case.

  • editing/inserting/crash-make-boundary-point-expected.txt: Added.
  • editing/inserting/crash-make-boundary-point.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r275315 r275320  
     12021-03-31  Venky Dass  <yaranamavenkataramana@apple.com>
     2
     3        Null pointer access crash in WebCore::makeBoundaryPoint(..)
     4        https://bugs.webkit.org/show_bug.cgi?id=223977
     5
     6        Reviewed by Darin Adler.
     7
     8        Adding a refression test case.
     9
     10        * editing/inserting/crash-make-boundary-point-expected.txt: Added.
     11        * editing/inserting/crash-make-boundary-point.html: Added.
     12
    1132021-03-31  Chris Gambrell  <cgambrell@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r275314 r275320  
     12021-03-31  Venky Dass  <yaranamavenkataramana@apple.com>
     2
     3        Null pointer access crash in WebCore::makeBoundaryPoint(..)
     4        https://bugs.webkit.org/show_bug.cgi?id=223977
     5
     6        Reviewed by Darin Adler.
     7
     8        In makeBoundaryPoint, position.containerNode() can be nullptr even if position.isNull() was false
     9
     10        Test: LayoutTests/editing/inserting/crash-make-boundary-point.html
     11
     12        * dom/Position.cpp:
     13        (WebCore::makeBoundaryPoint):
     14
    1152021-03-31  Eric Carlson  <eric.carlson@apple.com>
    216
  • trunk/Source/WebCore/dom/Position.cpp

    r271705 r275320  
    15951595Optional<BoundaryPoint> makeBoundaryPoint(const Position& position)
    15961596{
    1597     if (position.isNull())
     1597    auto container = makeRefPtr(position.containerNode());
     1598    if (!container)
    15981599        return WTF::nullopt;
    1599     return BoundaryPoint { *position.containerNode(), static_cast<unsigned>(position.computeOffsetInContainerNode()) };
     1600    return BoundaryPoint { container.releaseNonNull(), static_cast<unsigned>(position.computeOffsetInContainerNode()) };
    16001601}
    16011602
Note: See TracChangeset for help on using the changeset viewer.