Commit 10218386 authored by Oriol Brufau's avatar Oriol Brufau Committed by Chromium LUCI CQ

[editing] Avoid null deref in CanBeAnchorNode<EditingInFlatTreeStrategy>

The PositionInFlatTree(const Node*, int) constructor checks the node
with CanBeAnchorNode(). And for EditingInFlatTreeStrategy, this uses
node->CanParticipateInFlatTree(), which may be a null deref.

Therefore, this patch changes it to check whether the node is null.

Change-Id: Icf908f586641c9b1b57ac9ae1bf4e0ea9a0f1893
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2567220
Auto-Submit: Oriol Brufau <obrufau@igalia.com>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Cr-Commit-Position: refs/heads/master@{#832665}
parent 1a120349
......@@ -45,7 +45,7 @@ bool CanBeAnchorNode<EditingStrategy>(Node* node) {
template <>
bool CanBeAnchorNode<EditingInFlatTreeStrategy>(Node* node) {
return CanBeAnchorNode<EditingStrategy>(node) &&
node->CanParticipateInFlatTree();
(!node || node->CanParticipateInFlatTree());
}
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment