-
Notifications
You must be signed in to change notification settings - Fork 604
Infinite loop in fill_textbox #4400
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
Comments
Thanks for the report and reproducer. I have reproduced the problem in my tree, will investigate some more now and report back here later. |
I've just pushed a fix onto our |
Glad to have helped, and thanks for the fix! I'm not 100% sure about the change, compared to just changing the break condition to use Maybe I'm not seeing it, but how do you guarantee that the loop terminates? Or put another way, if n goes to 0, would it be better to raise an error (your assert) or break? |
I don't think changing the break condition to use The problem was this chain of events:
The new [I should probably have put some or all of this explanation into the commit message.] I hope that makes sense. |
Fixed in PyMuPDF-1.25.5. |
Description of the bug
Hi, first of all, thanks for a great library!
I found an infinite loop condition when calling
Writer.fill_textbox
due to a bug inutils.py
, where the correct counter for loop exit is not used.The fix is simple, lines 4619-4620 in this file should read
instead of
if len(words) == 0
.How to reproduce the bug
Minimal script to reproduce:
PyMuPDF version
1.25.4
Operating system
Windows
Python version
3.13
The text was updated successfully, but these errors were encountered: