Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/PIL/GimpPaletteFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class GimpPaletteFile:
#: override if reading larger palettes is needed
max_colors = 256
_max_line_size = 100
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're reading RGB data from each line. That's three integers. Under what circumstances would a user need to read more than 100 characters?

Copy link
Copy Markdown
Contributor Author

@jsbueno jsbueno Oct 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 4th Column contains the color name, though that is currently unused. And there might be a name with more than 100 characters - moving the number to an attribute just offers a chance of one working around an error imposed by an arbitrary, though reasonable, limit on an otherwise good file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(currently unused in PIL, that is: GIMP uses that name)

_max_file_size = 2**20
_max_file_size = 2 ** 20 # 1MB

def __init__(self, fp):

Expand All @@ -49,7 +49,7 @@ def __init__(self, fp):
warnings.warn(
f"Palette file truncated at {self._max_file_size - len(s)} bytes"
)
break
break # pragma: no cover
Comment thread
radarhere marked this conversation as resolved.
Outdated

# skip fields and comment lines
if re.match(rb"\w+:|#", s):
Expand Down