Skip to content

Conversation

@AndrewFasano
Copy link

Passing an empty file into File.from_path leads to an error that an empty file cannot be mmaped.

This could also be implemented in the from_path method, but I thought the is_valid method made since because an empty file isn't a valid gzip.

Fixes #786

@qkaiser qkaiser self-requested a review February 26, 2024 09:34
@qkaiser qkaiser force-pushed the fix_786 branch 2 times, most recently from 0494262 to 01a9d8f Compare February 26, 2024 10:02
@qkaiser
Copy link
Contributor

qkaiser commented Feb 26, 2024

Thanks @AndrewFasano ! I took the liberty to work on your branch to also cover the sevenzip multi-volume handler and add some checks in the File class + testing.

This is something that came up when I worked on fuzzing (see https://github.com/onekey-sec/unblob/blob/main/fuzzing/search_chunks_fuzzer.py#L50) but I left it on the side.

Will request a review from the team.

Copy link

@orosam orosam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one small suggestion, otherwise it looks good to me.

qkaiser and others added 3 commits February 28, 2024 10:01
…ty content.

Creating a File from empty bytes or an empty file would lead to mmap
raising an Exception so we check it ourselves and raise an
InvalidInputFormat if that happens.
@qkaiser qkaiser merged commit bbfca4e into onekey-sec:main Feb 28, 2024
@AndrewFasano AndrewFasano deleted the fix_786 branch February 28, 2024 17:58
e3krisztian added a commit that referenced this pull request Feb 29, 2024
This reverts commit bbfca4e, reversing
changes made to 61f6925.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mmap error during multi file calculation for multi-gzip

3 participants