Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibWeb: Crash when cursor property is url(something) (regression) #3567

Closed
1 task
aplefull opened this issue Feb 14, 2025 · 1 comment · Fixed by #3568
Closed
1 task

LibWeb: Crash when cursor property is url(something) (regression) #3567

aplefull opened this issue Feb 14, 2025 · 1 comment · Fixed by #3568

Comments

@aplefull
Copy link
Contributor

Summary

Crash occurs on these lines when cursor property is set to url(something) (I suspect after 4cb2063)

Cursor ComputedProperties::cursor() const
{
auto const& value = property(PropertyID::Cursor);
return keyword_to_cursor(value.to_keyword()).release_value();
}

I tried making a similar fix to what Sam did in 0fd0596 with list_style_type:

ListStyleType ComputedProperties::list_style_type() const
{
auto const& value = property(PropertyID::ListStyleType);
if (value.is_string())
return value.as_string().string_value().to_string();
return keyword_to_counter_style_name_keyword(value.to_keyword()).release_value();
}

But I am just not smart enough for this and couldn't figure it out, so posting an issue instead 😅

Operating system

Linux

Steps to reproduce

N/A

Expected behavior

N/A

Actual behavior

N/A

URL for a reduced test case

N/A

HTML/SVG/etc. source for a reduced test case

<style>
  * {
    cursor: url("");
  }
</style>

Log output and (if possible) backtrace

(gdb) bt
#0  ak_trap () at /home/aplefull/Repos/ladybird/AK/Assertions.cpp:100
#1  0x00007be27a701f83 in ak_verification_failed ()
    at /home/aplefull/Repos/ladybird/AK/Assertions.cpp:110
#2  0x00007be27b023c0c in AK::Optional<Web::CSS::Cursor>::release_value ()
    at /home/aplefull/Repos/ladybird/AK/Optional.h:302
#3  Web::CSS::ComputedProperties::cursor ()
    at /home/aplefull/Repos/ladybird/Libraries/LibWeb/CSS/ComputedProperties.cpp:956
#4  0x00007be27b5d803a in Web::Layout::NodeWithStyle::apply_style ()
    at /home/aplefull/Repos/ladybird/Libraries/LibWeb/Layout/Node.cpp:650
#5  0x00007be27b58604d in Web::Layout::NodeWithStyleAndBoxModelMetrics::NodeWithStyleAndBoxModelMetrics ()
    at /home/aplefull/Repos/ladybird/Libraries/LibWeb/Layout/Node.h:278
#6  Web::Layout::Box::Box ()
    at /home/aplefull/Repos/ladybird/Libraries/LibWeb/Layout/Box.cpp:18
#7  0x00007be27b5784fd in Web::Layout::BlockContainer::BlockContainer ()
    at /home/aplefull/Repos/ladybird/Libraries/LibWeb/Layout/BlockContainer.cpp:13
#8  0x00007be27b1fd79e in GC::Heap::allocate<Web::Layout::BlockContainer, Web::DOM::Document&, Web::DOM::Element*&, GC::Ref<Web::CSS::ComputedProperties> > ()
    at /home/aplefull/Repos/ladybird/Libraries/LibGC/Heap.h:45
#9  0x00007be27b1ec883 in Web::DOM::Element::create_layout_node_for_display_type () at /home/aplefull/Repos/ladybird/Libraries/LibWeb/DOM/Element.cpp:461

Screenshots or screen recordings

No response

Build flags or config settings

No response

Contribute a patch?

  • I’ll contribute a patch for this myself.
@aplefull
Copy link
Contributor Author

Oh, it turns out it was that simple! I thought we would have to pass url down and then use it in cursor 😅 Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant