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 #81490: ZipArchive::extractTo() may leak memory #7536

Closed
wants to merge 2 commits into from

Conversation

cmb69
Copy link
Contributor

@cmb69 cmb69 commented Sep 30, 2021

We always need to free the CWD state.

We always need to free the CWD state.
@cmb69 cmb69 added the Bug label Sep 30, 2021
@remicollet
Copy link
Contributor

I see other return without free ?
Ex:

	if (path_cleaned_len >= MAXPATHLEN || zip_stat(za, file, 0, &sb) != 0) {
		return 0;
	}

@remicollet
Copy link
Contributor

This one also looks strange (shouldn't the free be outside the if ?)

			if (!is_dir_only) {
				zend_string_release_ex(file_basename, 0);
				CWD_STATE_FREE(new_state.cwd);
			}
			return 0;

@cmb69
Copy link
Contributor Author

cmb69 commented Sep 30, 2021

Good catches, thanks!

Copy link
Contributor

@remicollet remicollet left a comment

Choose a reason for hiding this comment

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

LGTM

@cmb69 cmb69 closed this in 4d44271 Sep 30, 2021
@cmb69 cmb69 deleted the cmb/81490 branch September 30, 2021 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants