com php-src: Add more locale length checks, due to ICU bugs.: ext/intl/locale/locale_methods.c
| From: | Anatol Belski | Date: | Thu, 13 Oct 2016 23:40:36 +0000 |
| Subject: | com php-src: Add more locale length checks, due to ICU bugs.: ext/intl/locale/locale_methods.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95081@lists.php.net to get a copy of this message | ||
Commit: 0d9d133cd6318efc6a355397495cdfd38651500d
Author: Stanislav Malyshev <stas@php.net> Tue, 4 Oct 2016 21:28:40 -0700
Committer: Anatol Belski <ab@php.net> Fri, 14 Oct 2016 01:40:36 +0200
Parents: 336322ce63f4d6bd2abd2b187c9de387f387593f
Branches: PHP-7.1
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0d9d133cd6318efc6a355397495cdfd38651500d
Log:
Add more locale length checks, due to ICU bugs.
(cherry picked from commit d3eb58332af433982f1e2ae9095fb087974a95f2)
(cherry picked from commit 87a8240b5adc730153e6df54f33195aee1325e6f)
Changed paths:
M ext/intl/locale/locale_methods.c
Diff:
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c
index 8cf5bab..472220d 100644
--- a/ext/intl/locale/locale_methods.c
+++ b/ext/intl/locale/locale_methods.c
@@ -406,6 +406,8 @@ static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
if(loc_name_len == 0) {
loc_name = intl_locale_get_default();
}
+
+ INTL_CHECK_LOCALE_LEN(strlen(loc_name));
/* Call ICU get */
tag_value = get_icu_value_internal( loc_name , tag_name , &result ,0);
@@ -1165,6 +1167,7 @@ PHP_FUNCTION(locale_get_all_variants)
loc_name = intl_locale_get_default();
}
+ INTL_CHECK_LOCALE_LEN(strlen(loc_name));
array_init( return_value );
@@ -1273,6 +1276,9 @@ PHP_FUNCTION(locale_filter_matches)
RETURN_TRUE;
}
+ INTL_CHECK_LOCALE_LEN(strlen(loc_range));
+ INTL_CHECK_LOCALE_LEN(strlen(lang_tag));
+
if( boolCanonical ){
/* canonicalize loc_range */
can_loc_range=get_icu_value_internal( loc_range , LOC_CANONICALIZE_TAG , &result , 0);
@@ -1554,6 +1560,8 @@ PHP_FUNCTION(locale_lookup)
hash_arr = Z_ARRVAL_P(arr);
+ INTL_CHECK_LOCALE_LEN(strlen(loc_range));
+
if( !hash_arr || zend_hash_num_elements( hash_arr ) == 0 ) {
RETURN_EMPTY_STRING();
}