Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

archive_viewer: implement full front-to-back file scan & fix crash on exit #5554

Merged
merged 2 commits into from Feb 20, 2021

Conversation

rokm
Copy link
Member

@rokm rokm commented Feb 12, 2021

Implement full back-to-front file scan for the MAGIC pattern in the CArchive reader, as per discussion in #2372. This allows archive_viewer to find embedded package in binaries with additional appended data (e.g., digital signature). This also synchronizes the pattern search behavior in python-side CArchive implementation with bootloader-side changes proposed in #5511.

Fixes #2372.

The second commit fixes an assertion-related crash in archive_viewer that was uncovered during testing, and occurs when quitting the application or moving up a level.

@rokm rokm changed the title archive_viewer: implement full fron-to-back file scan & fix crash on exit archive_viewer: implement full front-to-back file scan & fix crash on exit Feb 12, 2021
… MAGIC

Allow archive-viewer to open binaries with more than 4096 bytes
of additional data past the appended package (e.g., macOS binaries
with code signature).
Calling arch.lib.close() when cleaning up the archive when either
moving up a level or quitting the archive_viewer application
triggers the assert in pyimod02_archive.ArchiveFile.__getattr__.

This is because local file object is set only between __enter__
and __exit__ calls, i.e., while in the `with arch.lib:` block.
Which also means that there's no need for attempting to close
those file handles in the first place, and the error is probably
a regression from when the thread-local file objects were
introduced.
@rokm
Copy link
Member Author

rokm commented Feb 19, 2021

Fixed a problem that one of the Windows CI pipelines tripped on; instead of trying to parse the whole cookie from last search buffer, we now need to explicitly read the whole cookie data into buffer before trying to parse it (as the search buffer may not contain the whole cookie).

@rokm rokm marked this pull request as ready for review February 19, 2021 10:46
@Legorooj Legorooj merged commit 58db420 into pyinstaller:develop Feb 20, 2021
@rokm rokm deleted the archive-viewer-fullscan branch February 25, 2021 12:54
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

archive_viewer not able to find CArchive
4 participants