Raise ValueError for negative values when loading P1-P3 PPM images by radarhere · Pull Request #7882 · python-pillow/Pillow

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

@radarhere

Copy link Copy Markdown

Member

Helps #7876

Pillow currently raises a ValueError when a value is too large in a P1-P3 PPM image.

if value > maxval:
msg_str = f"Channel value too large for this mode: {value}"
raise ValueError(msg_str)

This adds another ValueError if the value is negative.

@radarhere radarhere changed the title Raise a ValueError for negative values when loading P1-P3 PPM images Raise ValueError for negative values when loading P1-P3 PPM images

Mar 16, 2024

@hugovk hugovk merged commit ca97370 into python-pillow:main

Mar 21, 2024

@radarhere radarhere deleted the ppm branch

March 21, 2024 21:17

radarhere added a commit to radarhere/Pillow that referenced this pull request

Mar 24, 2024

hugovk added a commit that referenced this pull request

Mar 25, 2024

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@radarhere @hugovk