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

Fix #53467: Phar cannot compress large archives #6643

Closed
wants to merge 1 commit into from

Commits on Jan 26, 2021

  1. Fix #53467: Phar cannot compress large archives

    When Phars are flushed, a new temporary file is created for each entry
    which should be compressed, and the `compressed_filesize` is retrieved.
    Afterwards, the Phar manifest is written, and only after that the files
    are copied to the actual Phar.  So for each such entry there is an open
    temp file, what easily exceeds the limit.
    
    Therefore, we use a single temporary file for all entries, and store
    the start offset in the otherwise unused `header_offset` member.  We
    ensure that the `cfp` members are properly set to NULL even if flushing
    fails, to avoid use after free scenarios.
    
    This solution is based on a suggestion by @lserni[1].
    
    [1] <box-project/box2#80 (comment)>
    cmb69 committed Jan 26, 2021
    Configuration menu
    Copy the full SHA
    078eb20 View commit details
    Browse the repository at this point in the history