diff --git a/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp b/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp index aae5ea9c5f6..fa6ffee2ce9 100644 --- a/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp +++ b/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp @@ -172,10 +172,7 @@ Optional SVGDecodedImageData::intrinsic_aspect_ratio() const // https://www.w3.org/TR/SVG2/coords.html#SizingSVGInCSS auto width = intrinsic_width(); auto height = intrinsic_height(); - if (height.has_value() && *height == 0) - return {}; - - if (width.has_value() && height.has_value()) + if (width.has_value() && height.has_value() && *width > 0 && *height > 0) return *width / *height; if (auto const& viewbox = m_root_element->view_box(); viewbox.has_value()) { diff --git a/Tests/LibWeb/Crash/SVG/zero-width-svg.html b/Tests/LibWeb/Crash/SVG/zero-width-svg.html new file mode 100644 index 00000000000..7cce33f5081 --- /dev/null +++ b/Tests/LibWeb/Crash/SVG/zero-width-svg.html @@ -0,0 +1,2 @@ + +