com php-src: Fix bug #78804 - Segmentation fault in Locale::filterMatches: NEWS ext/intl/locale/locale_methods.c ext/intl/tests/bug 78804.phpt
| From: | Stanislav Malyshev | Date: | Tue, 12 Nov 2019 06:32:35 +0000 |
| Subject: | com php-src: Fix bug #78804 - Segmentation fault in Locale::filterMatches: NEWS ext/intl/locale/locale_methods.c ext/intl/tests/bug 78804.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-109243@lists.php.net to get a copy of this message | ||
Commit: 2c9926f156b2be6aa4f69a169d028c1ebc1eaa34
Author: Stanislav Malyshev <stas@php.net> Mon, 11 Nov 2019 22:30:08 -0800
Parents: ee243bc47155f8738b329bc5ce2fa95753c38154
Branches: PHP-7.2 PHP-7.3 PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2c9926f156b2be6aa4f69a169d028c1ebc1eaa34
Log:
Fix bug #78804 - Segmentation fault in Locale::filterMatches
Bugs:
https://bugs.php.net/78804
Changed paths:
M NEWS
M ext/intl/locale/locale_methods.c
A ext/intl/tests/bug78804.phpt
Diff:
diff --git a/NEWS b/NEWS
index 3160a9fdaa7..4deb2e12fba 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2019, PHP 7.2.26
+- Intl:
+ . Fixed bug #78804 (Segmentation fault in Locale::filterMatches). (Stas)
+
- Standard:
. Fixed bug #78759 (array_search in $GLOBALS). (Nikita)
@@ -27,7 +30,7 @@ PHP NEWS
cmb).
- OpCache:
- . Fixed bug #78654 (Incorrectly computed opcache checksum on files with
+ . Fixed bug #78654 (Incorrectly computed opcache checksum on files with
non-ascii characters). (mhagstrand)
. Fixed bug #78747 (OpCache corrupts custom extension result). (Nikita)
@@ -36,7 +39,7 @@ PHP NEWS
connections). (Nikita)
- Reflection:
- . Fixed bug #78697 (ReflectionClass::ImplementsInterface - inaccurate error
+ . Fixed bug #78697 (ReflectionClass::ImplementsInterface - inaccurate error
message with traits). (villfa)
- Sockets:
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c
index 768ae84d2cc..3379916822c 100644
--- a/ext/intl/locale/locale_methods.c
+++ b/ext/intl/locale/locale_methods.c
@@ -1292,7 +1292,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;
@@ -1300,7 +1300,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 00000000000..b0d58ec4309
--- /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