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

OverflowError in draw_first_line #2262

Closed
Shamzik opened this issue Sep 30, 2024 · 2 comments
Closed

OverflowError in draw_first_line #2262

Shamzik opened this issue Sep 30, 2024 · 2 comments
Labels
crash Problems preventing documents from being rendered
Milestone

Comments

@Shamzik
Copy link

Shamzik commented Sep 30, 2024

I encountered an OverflowError when trying to generate a PDF document from an HTML file using WeasyPrint version 62.3. The error occurs on the following line of code: weasyprint/draw.py#L1430.

Reproduction Steps

To reproduce the issue, you can use the minimal HTML and Python code snippets below.

Minimal HTML file:

<!DOCTYPE html>
<html>
<head>
    <style type="text/css">
        table {
            text-align: justify;
        }
    </style>
</head>
<body>
<table>
    <tr>
        <td>
            X Y ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
        </td>
    </tr>
</table>
</body>
</html>

Minimal Python code:

import argparse

import weasyprint


if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('html')
    parser.add_argument('pdf')
    args = parser.parse_args()

    with open(args.html, 'r') as html:
        with open(args.pdf, 'wb') as pdf:
            weasyprint.HTML(string=html.read()).write_pdf(pdf)

Expected Behavior

A PDF document should be generated without any errors.

Actual Behavior

An OverflowError is raised when attempting to generate the PDF.

Environment

  • WeasyPrint version: 62.3
  • Python version: 3.12
  • Operating System: Ubuntu
@grewn0uille grewn0uille added the crash Problems preventing documents from being rendered label Sep 30, 2024
@grewn0uille
Copy link
Member

Thanks for your report!

Font to reproduce: DejaVu Serif.

@liZe liZe closed this as completed in 1aae145 Oct 5, 2024
@liZe liZe added this to the 63.0 milestone Oct 5, 2024
@liZe
Copy link
Member

liZe commented Oct 5, 2024

It’s now fixed, feedback is welcome!

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

3 participants