Skip to content

Commit 71aa83b

Browse files
dixyesnielsdos
authored andcommitted
Fix stream double free in phar
1 parent 69328ba commit 71aa83b

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
@@ -2298,6 +2298,13 @@ static zend_object *phar_convert_to_other(phar_archive_data *source, int convert
22982298
/* exception already thrown */
22992299
return NULL;
23002300
}
2301+
2302+
if (newentry.fp == NULL) {
2303+
/* entry->fp may be moved to cfp in phar_copy_file_contents
2304+
* and be free'd later in phar_flush_ex
2305+
* If so, zero fp to avoid double free in rshutdown. */
2306+
entry->fp = NULL;
2307+
}
23012308
no_copy:
23022309
newentry.filename = estrndup(newentry.filename, newentry.filename_len);
23032310

0 commit comments

Comments
 (0)