Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion ext/phar/phar_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -4494,7 +4494,19 @@ PHP_METHOD(PharFileInfo, getCompressedSize)

PHAR_ENTRY_OBJECT();

RETURN_LONG(entry_obj->entry->compressed_filesize);
uint32_t compressed_filesize = entry_obj->entry->compressed_filesize;

#if SIZEOF_ZEND_LONG < 8
/* The size is read as an unsigned 32-bit value from the archive, so it
* does not necessarily fit into a 32-bit zend_long. */
if (UNEXPECTED(compressed_filesize > (uint32_t) ZEND_LONG_MAX)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar entry has a compressed size that is too large to be represented as an int on this platform");
RETURN_THROWS();
}
#endif

RETURN_LONG((zend_long) compressed_filesize);
}
/* }}} */

Expand Down
Loading