Permalink
Browse files

fix bug #61065

(cherry picked from commit a10e778)
  • Loading branch information...
1 parent 93c91c7 commit 4eb802bb14b05b82573457bc0f528e61ca7ddc45 @smalyshev smalyshev committed with johannes May 16, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 ext/phar/tar.c
View
@@ -337,6 +337,16 @@ int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias,
last_was_longlink = 1;
/* support the ././@LongLink system for storing long filenames */
entry.filename_len = entry.uncompressed_filesize;
+
+ /* Check for overflow - bug 61065 */
+ if (entry.filename_len == UINT_MAX) {
+ if (error) {
+ spprintf(error, 4096, "phar error: \"%s\" is a corrupted tar file (invalid entry size)", fname);
+ }
+ php_stream_close(fp);
+ phar_destroy_phar_data(myphar TSRMLS_CC);
+ return FAILURE;
+ }
entry.filename = pemalloc(entry.filename_len+1, myphar->is_persistent);
read = php_stream_read(fp, entry.filename, entry.filename_len);

0 comments on commit 4eb802b

Please sign in to comment.