Skip to content

Possible missing "PA" check #6502

@Yay295

Description

@Yay295

# Keep pointer to im object to prevent dereferencing.
self._im = img.im
if self._im.mode == "P":
self._palette = img.palette

This code saves a reference to the image palette, but only for "P" mode images. I think it should probably check for "PA" here too. This saved palette is used later in this class, but again only for "P", not "PA".

if (
self._im.mode == "P"
and isinstance(color, (list, tuple))
and len(color) in [3, 4]
):
# RGB or RGBA value for a P image
color = self._palette.getcolor(color, self._img)

I haven't checked if this palette reference is used outside of this class, though it is supposed to be private so hopefully not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions