diff options
-rw-r--r-- | ext/phar/tar.c | 6 | ||||
-rw-r--r-- | sapi/cli/tests/bug61546.phpt | 11 |
2 files changed, 13 insertions, 4 deletions
diff --git a/ext/phar/tar.c b/ext/phar/tar.c index b914db129e..917734c992 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -38,7 +38,7 @@ static php_uint32 phar_tar_number(char *buf, int len) /* {{{ */ /* }}} */ /* adapted from format_octal() in libarchive - * + * * Copyright (c) 2003-2009 Tim Kientzle * All rights reserved. * @@ -161,7 +161,7 @@ static int phar_tar_process_metadata(phar_entry_info *entry, php_stream *fp TSRM size_t save = php_stream_tell(fp), read; phar_entry_info *mentry; - metadata = (char *) emalloc(entry->uncompressed_filesize + 1); + metadata = (char *) safe_emalloc(1, entry->uncompressed_filesize, 1); read = php_stream_read(fp, metadata, entry->uncompressed_filesize); if (read != entry->uncompressed_filesize) { @@ -377,7 +377,7 @@ bail: } read = php_stream_read(fp, buf, sizeof(buf)); - + if (read != sizeof(buf)) { efree(entry.filename); if (error) { diff --git a/sapi/cli/tests/bug61546.phpt b/sapi/cli/tests/bug61546.phpt index 2cd690f65c..071edb7224 100644 --- a/sapi/cli/tests/bug61546.phpt +++ b/sapi/cli/tests/bug61546.phpt @@ -2,13 +2,22 @@ Bug #61546 (functions related to current script failed when chdir() in cli sapi) --FILE-- <?php +// reference doc for getmyinode() on php.net states that it returns an integer or FALSE on error +// on Windows, getmyinode() returns 0 which normally casts to FALSE +// however, the implementation of getmyinode() (in pageinfo.c) returns an explicit FALSE in the +// event that the internal page_inode structure is less than 0, otherwise it returns the long value +// of page_inode. therefore, an explicit 0 should be a passing value for this test. +// +// the ext/standard/tests/file/statpage.phpt test also tests getmyinode() returns an integer and will +// pass even if that integer is 0. on Windows, the getmyinode() call in statpage.phpt returns 0 and +// passes on Windows. $php = getenv("TEST_PHP_EXECUTABLE"); $test_code = <<<PHP <?php chdir('..'); var_dump(get_current_user() != ""); chdir('..'); -var_dump(getmyinode() != false); +var_dump(getmyinode() !== false); var_dump(getlastmod() != false); PHP; |