mirror of
https://github.com/php/php-src.git
synced 2026-04-03 14:12:38 +02:00
Fix bug #67349: Locale::parseLocale Double Free
This commit is contained in:
@@ -269,8 +269,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;
|
||||
@@ -280,8 +279,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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' ,
|
||||
|
||||
Reference in New Issue
Block a user