Skip to content

negative seeking in XZ handler #270

@qkaiser

Description

@qkaiser

Came upon a sample that made XZ seek before the start of the file:

Traceback (most recent call last):
  File "/home/quentin/unblob/unblob/finder.py", line 75, in search_chunks_by_priority
    chunk = handler.calculate_chunk(limited_reader, real_offset)
  File "/home/quentin/unblob/unblob/handlers/compression/xz.py", line 74, in calculate_chunk
    file.seek(-real_backward_size, io.SEEK_CUR)
  File "/home/quentin/unblob/unblob/file_utils.py", line 204, in seek
    new_pos = self._file.seek(offset, whence)
OSError: [Errno 22] Invalid argument

We should verify that real_backward_size is not larger than our current position in the file.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions