Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/PIL/FliImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

def _accept(prefix: bytes) -> bool:
return (
len(prefix) >= 6
len(prefix) >= 16
and i16(prefix, 4) in [0xAF11, 0xAF12]
and i16(prefix, 14) in [0, 3] # flags
)
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/GribStubImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def register_handler(handler: ImageFile.StubHandler | None) -> None:


def _accept(prefix: bytes) -> bool:
return prefix.startswith(b"GRIB") and prefix[7] == 1
return len(prefix) >= 8 and prefix.startswith(b"GRIB") and prefix[7] == 1


class GribStubImageFile(ImageFile.StubImageFile):
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/PcxImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@


def _accept(prefix: bytes) -> bool:
return prefix[0] == 10 and prefix[1] in [0, 2, 3, 5]
return len(prefix) >= 2 and prefix[0] == 10 and prefix[1] in [0, 2, 3, 5]


##
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/PpmImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@


def _accept(prefix: bytes) -> bool:
return prefix.startswith(b"P") and prefix[1] in b"0123456fy"
return len(prefix) >= 2 and prefix.startswith(b"P") and prefix[1] in b"0123456fy"


##
Expand Down
Loading