Skip to content

Commit 6553f0f

Browse files
committed
Match all 8 bytes of PNG signature
1 parent 0c7f219 commit 6553f0f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

filetype/types/image.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,15 @@ def __init__(self):
133133
)
134134

135135
def match(self, buf):
136-
return (len(buf) > 3 and
136+
return (len(buf) > 8 and
137137
buf[0] == 0x89 and
138138
buf[1] == 0x50 and
139139
buf[2] == 0x4E and
140-
buf[3] == 0x47)
141-
140+
buf[3] == 0x47 and
141+
buf[4] == 0x0D and
142+
buf[5] == 0x0A and
143+
buf[6] == 0x1A and
144+
buf[7] == 0x0A)
142145

143146
class Gif(Type):
144147
"""

0 commit comments

Comments
 (0)