diff options
author | Stanislav Malyshev <stas@php.net> | 2019-11-11 23:08:38 -0800 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2019-11-11 23:08:38 -0800 |
commit | ea2a125789d2e6cf7416bd706be1ac44df1367e4 (patch) | |
tree | ce247de08f5bd2d1a575922bbc94b1ef5726f7b2 | |
parent | 4a55794b980c3d4b85788f5adb7d1fe5ec1a58e3 (diff) | |
parent | 2c9926f156b2be6aa4f69a169d028c1ebc1eaa34 (diff) | |
download | php-git-ea2a125789d2e6cf7416bd706be1ac44df1367e4.tar.gz |
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
Fix bug #78804 - Segmentation fault in Locale::filterMatches
-rw-r--r-- | ext/intl/locale/locale_methods.c | 4 | ||||
-rw-r--r-- | ext/intl/tests/bug78804.phpt | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index ae624936a7..7ab633cef9 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -1285,7 +1285,7 @@ PHP_FUNCTION(locale_filter_matches) if( boolCanonical ){ /* canonicalize loc_range */ can_loc_range=get_icu_value_internal( loc_range , LOC_CANONICALIZE_TAG , &result , 0); - if( result ==0) { + if( result <=0) { intl_error_set( NULL, status, "locale_filter_matches : unable to canonicalize loc_range" , 0 ); RETURN_FALSE; @@ -1293,7 +1293,7 @@ PHP_FUNCTION(locale_filter_matches) /* canonicalize lang_tag */ can_lang_tag = get_icu_value_internal( lang_tag , LOC_CANONICALIZE_TAG , &result , 0); - if( result ==0) { + if( result <=0) { intl_error_set( NULL, status, "locale_filter_matches : unable to canonicalize lang_tag" , 0 ); RETURN_FALSE; diff --git a/ext/intl/tests/bug78804.phpt b/ext/intl/tests/bug78804.phpt new file mode 100644 index 0000000000..b0d58ec430 --- /dev/null +++ b/ext/intl/tests/bug78804.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #78804: Segmentation fault in Locale::filterMatches +--FILE-- +<?php + +if (Locale::filterMatches('en-US', 'und', true)) { + echo 'Matches'; +} else { + echo 'Not matches'; +} +?> +--EXPECT-- +Not matches
\ No newline at end of file |