- Make internal code forward-compatible. This included a binary cast in the default stub, hence test updates.
This commit is contained in:
Steph Fox 2008-05-14 21:29:51 +00:00
parent b3b5126954
commit 6a0682d986
18 changed files with 129 additions and 85 deletions

View file

@ -817,7 +817,7 @@ int phar_open_file(php_stream *fp, char *fname, int fname_len, char *alias, int
register_alias = 1;
temp_alias = 1;
}
/* we have 5 32-bit items plus 1 byte at least */
if (manifest_count > ((manifest_len - 10 - tmp_len) / (5 * 4 + 1))) {
/* prevent serious memory issues */
@ -1592,7 +1592,8 @@ woohoo:
return FAILURE;
}
} else {
char *key;
phar_zstr key;
char *str_key;
uint keylen;
ulong unused;
@ -1602,11 +1603,13 @@ woohoo:
break;
}
PHAR_STR(key, str_key);
if (keylen > (uint) filename_len) {
zend_hash_move_forward(&(PHAR_GLOBALS->phar_fname_map));
continue;
}
if (!memcmp(filename, key, keylen) && ((uint)filename_len == keylen
if (!memcmp(filename, str_key, keylen) && ((uint)filename_len == keylen
|| filename[keylen] == '/' || filename[keylen] == '\0')) {
if (FAILURE == zend_hash_get_current_data(&(PHAR_GLOBALS->phar_fname_map), (void **) &pphar)) {
break;
@ -2847,7 +2850,7 @@ static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type
}
} else if (phar->flags & PHAR_FILE_COMPRESSION_MASK) {
/* compressed phar */
#if PHP_VERSION_ID >= 50300 && PHP_VERSION_ID < 60000
#if PHP_VERSION_ID >= 50300
file_handle->type = ZEND_HANDLE_STREAM;
file_handle->free_filename = 0;
file_handle->handle.stream.handle = phar;