mirror of
https://github.com/php/php-src.git
synced 2026-04-17 04:51:03 +02:00
Merge branch 'PHP-5.4.30' into PHP-5.4
* PHP-5.4.30: 5.4.30 Better fix for bug #67072 with more BC provisions Fix bug #67498 - phpinfo() Type Confusion Information Leak Vulnerability update CVE Fix bug #67492: unserialize() SPL ArrayObject / SPLObjectStorage Type Confusion Fix bug #67397 (Buffer overflow in locale_get_display_name->uloc_getDisplayName (libicu 4.8.1)) Fix bug #67349: Locale::parseLocale Double Free add CVEs Fix potential segfault in dns_get_record() Fix bug #66127 (Segmentation fault with ArrayObject unset) 5.4.30 rc1 Conflicts: configure.in main/php_version.h
This commit is contained in:
@@ -272,8 +272,7 @@ static char* get_icu_value_internal( char* loc_name , char* tag_name, int* resul
|
||||
grOffset = findOffset( LOC_GRANDFATHERED , loc_name );
|
||||
if( grOffset >= 0 ){
|
||||
if( strcmp(tag_name , LOC_LANG_TAG)==0 ){
|
||||
tag_value = estrdup(loc_name);
|
||||
return tag_value;
|
||||
return estrdup(loc_name);
|
||||
} else {
|
||||
/* Since Grandfathered , no value , do nothing , retutn NULL */
|
||||
return NULL;
|
||||
@@ -283,8 +282,8 @@ static char* get_icu_value_internal( char* loc_name , char* tag_name, int* resul
|
||||
if( fromParseLocale==1 ){
|
||||
/* Handle singletons */
|
||||
if( strcmp(tag_name , LOC_LANG_TAG)==0 ){
|
||||
if( strlen(loc_name)>1 && (isIDPrefix(loc_name) ==1 ) ){
|
||||
return loc_name;
|
||||
if( strlen(loc_name)>1 && isIDPrefix(loc_name) ){
|
||||
return estrdup(loc_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,8 +500,16 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if(loc_name_len > ULOC_FULLNAME_CAPACITY) {
|
||||
/* See bug 67397: overlong locale names cause trouble in uloc_getDisplayName */
|
||||
spprintf(&msg , 0, "locale_get_display_%s : name too long", tag_name );
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, msg , 1 TSRMLS_CC );
|
||||
efree(msg);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if(loc_name_len == 0) {
|
||||
loc_name = INTL_G(default_locale);
|
||||
loc_name = INTL_G(default_locale);
|
||||
}
|
||||
|
||||
if( strcmp(tag_name, DISP_NAME) != 0 ){
|
||||
|
||||
21
ext/intl/tests/bug67397.phpt
Normal file
21
ext/intl/tests/bug67397.phpt
Normal file
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #67397 (Buffer overflow in locale_get_display_name->uloc_getDisplayName (libicu 4.8.1))
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
$ret = var_export(ut_loc_get_display_name(str_repeat('*', 256), 'en_us'), true);
|
||||
$ret .= "\n";
|
||||
$ret .= var_export(intl_get_error_message(), true);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
?>
|
||||
--EXPECTF--
|
||||
false
|
||||
'locale_get_display_name : name too long: U_ILLEGAL_ARGUMENT_ERROR'
|
||||
@@ -63,7 +63,8 @@ function ut_main()
|
||||
//Some Invalid Tags:
|
||||
'de-419-DE',
|
||||
'a-DE',
|
||||
'ar-a-aaa-b-bbb-a-ccc'
|
||||
'ar-a-aaa-b-bbb-a-ccc',
|
||||
'x-AAAAAA',
|
||||
);
|
||||
|
||||
|
||||
@@ -201,3 +202,6 @@ No values found from Locale parsing.
|
||||
---------------------
|
||||
ar-a-aaa-b-bbb-a-ccc:
|
||||
language : 'ar' ,
|
||||
---------------------
|
||||
x-AAAAAA:
|
||||
private0 : 'AAAAAA' ,
|
||||
|
||||
@@ -1808,7 +1808,7 @@ SPL_METHOD(Array, unserialize)
|
||||
++p;
|
||||
|
||||
ALLOC_INIT_ZVAL(pmembers);
|
||||
if (!php_var_unserialize(&pmembers, &p, s + buf_len, &var_hash TSRMLS_CC)) {
|
||||
if (!php_var_unserialize(&pmembers, &p, s + buf_len, &var_hash TSRMLS_CC) || Z_TYPE_P(pmembers) != IS_ARRAY) {
|
||||
zval_ptr_dtor(&pmembers);
|
||||
goto outexcept;
|
||||
}
|
||||
|
||||
@@ -898,7 +898,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
|
||||
++p;
|
||||
|
||||
ALLOC_INIT_ZVAL(pmembers);
|
||||
if (!php_var_unserialize(&pmembers, &p, s + buf_len, &var_hash TSRMLS_CC)) {
|
||||
if (!php_var_unserialize(&pmembers, &p, s + buf_len, &var_hash TSRMLS_CC) || Z_TYPE_P(pmembers) != IS_ARRAY) {
|
||||
zval_ptr_dtor(&pmembers);
|
||||
goto outexcept;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ $badblobs = array(
|
||||
'x:i:2;i:0;,i:1;;i:0;,i:2;;m:a:0:{}',
|
||||
'x:i:3;O:8:"stdClass":0:{},O:8:"stdClass":0:{};R:2;,i:1;;O:8:"stdClass":0:{},r:2;;m:a:0:{}',
|
||||
'x:i:3;O:8:"stdClass":0:{},O:8:"stdClass":0:{};r:2;,i:1;;O:8:"stdClass":0:{},r:2;;m:a:0:{}',
|
||||
'x:i:1;O:8:"stdClass":0:{},N;;m:s:40:"1234567890123456789012345678901234567890"',
|
||||
);
|
||||
foreach($badblobs as $blob) {
|
||||
try {
|
||||
@@ -17,6 +18,7 @@ try {
|
||||
echo $e->getMessage()."\n";
|
||||
}
|
||||
}
|
||||
echo "DONE\n";
|
||||
--EXPECTF--
|
||||
Error at offset 6 of 34 bytes
|
||||
Error at offset 46 of 89 bytes
|
||||
@@ -42,4 +44,5 @@ object(SplObjectStorage)#2 (1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Error at offset 79 of 78 bytes
|
||||
DONE
|
||||
|
||||
@@ -875,16 +875,16 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
|
||||
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_header(2, "Variable", "Value");
|
||||
if (zend_hash_find(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void **) &data) != FAILURE) {
|
||||
if (zend_hash_find(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void **) &data) != FAILURE && Z_TYPE_PP(data) == IS_STRING) {
|
||||
php_info_print_table_row(2, "PHP_SELF", Z_STRVAL_PP(data));
|
||||
}
|
||||
if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_TYPE", sizeof("PHP_AUTH_TYPE"), (void **) &data) != FAILURE) {
|
||||
if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_TYPE", sizeof("PHP_AUTH_TYPE"), (void **) &data) != FAILURE && Z_TYPE_PP(data) == IS_STRING) {
|
||||
php_info_print_table_row(2, "PHP_AUTH_TYPE", Z_STRVAL_PP(data));
|
||||
}
|
||||
if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER"), (void **) &data) != FAILURE) {
|
||||
if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER"), (void **) &data) != FAILURE && Z_TYPE_PP(data) == IS_STRING) {
|
||||
php_info_print_table_row(2, "PHP_AUTH_USER", Z_STRVAL_PP(data));
|
||||
}
|
||||
if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) {
|
||||
if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE && Z_TYPE_PP(data) == IS_STRING) {
|
||||
php_info_print_table_row(2, "PHP_AUTH_PW", Z_STRVAL_PP(data));
|
||||
}
|
||||
php_print_gpcse_array(ZEND_STRL("_REQUEST") TSRMLS_CC);
|
||||
|
||||
15
ext/standard/tests/general_functions/bug67498.phpt
Normal file
15
ext/standard/tests/general_functions/bug67498.phpt
Normal file
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
phpinfo() Type Confusion Information Leak Vulnerability
|
||||
--FILE--
|
||||
<?php
|
||||
$PHP_SELF = 1;
|
||||
phpinfo(INFO_VARIABLES);
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
phpinfo()
|
||||
|
||||
PHP Variables
|
||||
%A
|
||||
==DONE==
|
||||
Reference in New Issue
Block a user