LibWeb: Fix division by zero on a zero-height viewport SVG image

This commit is contained in:
Shannon Booth 2024-05-19 15:34:56 +12:00 committed by Andreas Kling
parent d48316ce15
commit dd20156010
Notes: sideshowbarker 2024-07-17 01:13:25 +09:00
3 changed files with 17 additions and 0 deletions

View file

@ -162,6 +162,8 @@ Optional<CSSPixelFraction> SVGDecodedImageData::intrinsic_aspect_ratio() const
return {};
auto viewbox_height = CSSPixels::nearest_value_for(viewbox->height);
if (viewbox_height == 0)
return {};
return viewbox_width / viewbox_height;
}