Skip to content

Conversation

@radarhere
Copy link
Member

  1. Simplify a check for width and height, as they cannot actually be less than zero.

    from ._binary import i32be as i32

    width = i32(self.fp.read(4))
    height = i32(self.fp.read(4))
    color_depth = i32(self.fp.read(4))
    if width <= 0 or height <= 0:

    def i32be(c: bytes, o: int = 0) -> int:
    return unpack_from(">I", c, o)[0]

    where I is an unsigned integer.

  2. Add coverage for the lines missing at https://app.codecov.io/gh/python-pillow/Pillow/blob/main/src%2FPIL%2FGbrImagePlugin.py

@hugovk hugovk merged commit 801f7ad into python-pillow:main Aug 27, 2025
57 checks passed
@radarhere radarhere deleted the gbr branch August 27, 2025 20:08
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.

2 participants