1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

LibWeb: Remove early continue in size parsing

Step 5 of parsing was always skipped because step 4 continues.

Running step 5 causes some of the denominators to be 0 and causes
divide by zero error in CSSPixelFraction.

SVG Image with height of 0 will cause divide by zero error when
calculating intrinsic aspect ratio of SVGDecoderImageData.

We also get a divide by zero error in AlignContent::SpaceBetween of the
FlexFormatingContext.

During auto track stretching in GridFormatingContext there is a
possibility for count_of_auto_max_sizing_tracks to stay 0.
This commit is contained in:
Bastian Neumann 2024-01-15 20:26:12 +01:00 committed by Alexander Kalenik
parent e2bc606eeb
commit 7cd489d6aa
6 changed files with 15 additions and 8 deletions

View file

@ -1488,8 +1488,9 @@ void FlexFormattingContext::align_all_flex_lines()
start_of_current_line = 0;
auto leftover_free_space = cross_size_of_flex_container - sum_of_flex_line_cross_sizes;
if (leftover_free_space >= 0) {
int gap_count = m_flex_lines.size() - 1;
auto leftover_flex_lines_size = m_flex_lines.size();
if (leftover_free_space >= 0 && leftover_flex_lines_size > 1) {
int gap_count = leftover_flex_lines_size - 1;
gap_size = leftover_free_space / gap_count;
}
break;