com php-src: Fix bug #67349: Locale::parseLocale Double Free: ext/intl/locale/locale_methods.c ext/intl/tests/locale_ parse_locale2.phpt
| From: | JulienPauli | Date: | Wed, 25 Jun 2014 09:51:50 +0000 |
| Subject: | com php-src: Fix bug #67349: Locale::parseLocale Double Free: ext/intl/locale/locale_methods.c ext/intl/tests/locale_ parse_locale2.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-79073@lists.php.net to get a copy of this message | ||
Commit: f2f038046fd6e93b4c750b557586a08e5f4c38a5
Author: Stanislav Malyshev <stas@php.net> Wed, 4 Jun 2014 01:06:01 -0700
Committer: Julien Pauli <jpauli@php.net> Wed, 25 Jun 2014 11:51:50 +0200
Parents: 038baca3a1f0676a8062b04a2923ef6630c3e41c
Branches: PHP-5.5.14
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f2f038046fd6e93b4c750b557586a08e5f4c38a5
Log:
Fix bug #67349: Locale::parseLocale Double Free
Bugs:
https://bugs.php.net/67349
Changed paths:
M ext/intl/locale/locale_methods.c
M ext/intl/tests/locale_parse_locale2.phpt
Diff:
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c
index 21b5847..020289b 100644
--- a/ext/intl/locale/locale_methods.c
+++ b/ext/intl/locale/locale_methods.c
@@ -269,8 +269,7 @@ static char* get_icu_value_internal( const char* loc_name , char* tag_name, int*
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;
@@ -280,8 +279,8 @@ static char* get_icu_value_internal( const char* loc_name , char* tag_name, int*
if( fromParseLocale==1 ){
/* Handle singletons */
if( strcmp(tag_name , LOC_LANG_TAG)==0 ){
- if( strlen(loc_name)>1 && (isIDPrefix(loc_name) ==1 ) ){
- return (char *)loc_name;
+ if( strlen(loc_name)>1 && isIDPrefix(loc_name) ){
+ return estrdup(loc_name);
}
}
diff --git a/ext/intl/tests/locale_parse_locale2.phpt b/ext/intl/tests/locale_parse_locale2.phpt
index 6012862..30cc8cc 100644
--- a/ext/intl/tests/locale_parse_locale2.phpt
+++ b/ext/intl/tests/locale_parse_locale2.phpt
@@ -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' ,