Skip to content

fix: skip widgets with empty or infinite rects in remove_rotation#4953

Open
thakoreh wants to merge 1 commit intopymupdf:mainfrom
thakoreh:fix/remove-rotation-empty-widget
Open

fix: skip widgets with empty or infinite rects in remove_rotation#4953
thakoreh wants to merge 1 commit intopymupdf:mainfrom
thakoreh:fix/remove-rotation-empty-widget

Conversation

@thakoreh
Copy link
Copy Markdown

Fixes #4950

remove_rotation() iterates over all widgets and calls widget.update()
after transforming their rect. Widgets with empty or infinite rects
(like invisible signature fields with Rect(0, 0, 0, 0)) cause
ValueError('bad rect') during the internal validation in update().

This skips widgets with empty or infinite rects before the update
call, and wraps widget.update() in a try/except for any remaining
edge cases.

remove_rotation() calls widget.update() on every widget, but widgets
with empty or infinite rects (like invisible signature fields) cause
ValueError('bad rect') during validation.

Skip these widgets and also guard widget.update() with a try/except
for any remaining edge cases.

Fixes pymupdf#4950
@github-actions
Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@thakoreh
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

remove_rotation() raises ValueError on widgets with empty/infinite rects

1 participant