Skip to content

Conversation

@karlseguin
Copy link
Collaborator

Netsurf's dom_node_is_equal appears to be both unsafe and incorrect. It's unsafe because various node types don't have the dom_node_get_attributes implementation so they default to setting the node attributes to null: https://github.com/lightpanda-io/libdom/blob/master/src/core/node.c#L658

However, it doesn't do a NULL check when comparing them, so it crashes: https://github.com/lightpanda-io/libdom/blob/da8b967905a38455e4f6b75cc9ad2767bae3ccde/src/core/namednodemap.c#L312

Furthermore, specific nodes need to be compared using specific attributes/values.

This PR fixes a WPT crash.

Netsurf's dom_node_is_equal appears to be both unsafe and incorrect. It's unsafe
because various node types don't have the dom_node_get_attributes implementation
so they default to setting the node attributes to null:
https://github.com/lightpanda-io/libdom/blob/master/src/core/node.c#L658

However, it doesn't do a NULL check when comparing them, so it crashes:
https://github.com/lightpanda-io/libdom/blob/da8b967905a38455e4f6b75cc9ad2767bae3ccde/src/core/namednodemap.c#L312

Furthermore, specific nodes need to be compared using specific attributes/values.

This PR fixes a WPT crash.
@krichprollsch krichprollsch merged commit 6b1e7a1 into main Apr 23, 2025
12 checks passed
@krichprollsch krichprollsch deleted the node_is_equal branch April 23, 2025 07:50
@github-actions github-actions bot locked and limited conversation to collaborators Apr 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants