mirror of
https://github.com/python-pillow/Pillow.git
synced 2026-02-03 22:15:52 +03:00
Stop reading when the end of the file is reached
This commit is contained in:
parent
e08f910db4
commit
a232e8ae44
|
|
@ -509,7 +509,10 @@ class DdsRgbDecoder(ImageFile.PyDecoder):
|
|||
bytecount = bitcount // 8
|
||||
dest_length = self.state.xsize * self.state.ysize * len(masks)
|
||||
while len(data) < dest_length:
|
||||
value = int.from_bytes(self.fd.read(bytecount), "little")
|
||||
bytes_read = self.fd.read(bytecount)
|
||||
if len(bytes_read) < bytecount:
|
||||
break
|
||||
value = int.from_bytes(bytes_read, "little")
|
||||
for i, mask in enumerate(masks):
|
||||
masked_value = value & mask
|
||||
# Remove the zero padding, and scale it to 8 bits
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user