Chunker: fix infinite loop

Could happen at EOF when remaining data is insufficient and no new data can be added.
This commit is contained in:
Thomas Waldmann 2025-05-28 10:59:17 +02:00
parent 5445a52994
commit a235cff0c5
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01

View file

@ -680,7 +680,7 @@ cdef class Chunker:
self.remaining -= min_size
sum = _buzhash(self.data + self.position, window_size, self.table)
while self.remaining > self.window_size and (sum & chunk_mask):
while self.remaining > self.window_size and (sum & chunk_mask) and not (self.eof and self.remaining <= window_size):
p = self.data + self.position
stop_at = p + self.remaining - window_size