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

Division by zero (floor/ceil, ambiguous operator precedence) #2103

Closed
forthrin opened this issue Mar 20, 2024 · 1 comment
Closed

Division by zero (floor/ceil, ambiguous operator precedence) #2103

forthrin opened this issue Mar 20, 2024 · 1 comment
Labels
crash Problems preventing documents from being rendered
Milestone

Comments

@forthrin
Copy link

$ weasyprint https://www.nrk.no/ index.pdf
ZeroDivisionError: division by zero

https://github.com/Kozea/WeasyPrint/blob/main/weasyprint/layout/column.py#L53

    count = 2
    box_width = 92.873046875
    gap = 20.0
    width = 160.0
    count = min(count, int(floor((box.width + gap) / (width + gap)))) # floor -> math.ceil (?)
    width = (box.width + gap) / count - gap # count=0
    # width = (box.width + gap) / (count - gap) # Possible intention A
    # width = ((box.width + gap) / count) - gap # Possible intention B
@liZe liZe closed this as completed in 2d7c9a2 Mar 20, 2024
@liZe liZe added the crash Problems preventing documents from being rendered label Mar 20, 2024
@liZe liZe added this to the 62.0 milestone Mar 20, 2024
@liZe
Copy link
Member

liZe commented Mar 20, 2024

Thanks a lot for your report! It’s fixed and tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Problems preventing documents from being rendered
Projects
None yet
Development

No branches or pull requests

2 participants