Skip to content

Commit 6060b5e

Browse files
committed
Fix stream double free in phar
1 parent 8b61c49 commit 6060b5e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎ext/phar/phar_object.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2306,6 +2306,13 @@ static zend_object *phar_convert_to_other(phar_archive_data *source, int convert
23062306
/* exception already thrown */
23072307
return NULL;
23082308
}
2309+
2310+
if (newentry.fp == NULL) {
2311+
/* entry->fp may be moved to cfp in phar_copy_file_contents
2312+
* and be free'd later in phar_flush_ex
2313+
* If so, zero fp to avoid double free in rshutdown. */
2314+
entry->fp = NULL;
2315+
}
23092316
no_copy:
23102317
newentry.filename = zend_string_copy(newentry.filename);
23112318

0 commit comments

Comments
 (0)